Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: v_borchert@despammed.com (Volker Borchert) Newsgroups: comp.lang.java.programmer Subject: Re: OutputStream.write(int) Date: 6 Jun 2016 03:19:33 GMT Organization: Private site at Eddersheim, Germany Lines: 25 Distribution: world Message-ID: References: X-Trace: individual.net Sf3eKH4doAuAx+gJNs9CUQ5cNZvKn7Nj5nffgzxf/kSsPUhkzU Cancel-Lock: sha1:fjBwXphzA7HO9z2VxqZ2XhJETKI= Xref: csiph.com comp.lang.java.programmer:34486 Jan Burse wrote: > At least we can say that 0x000000 and 0xFFFFFF must be ignored, > otherwise the default implementation of write(byte[],..) gets > broken: I can see 0x000000, but not 0xffffff. And I'd be more suspicious about <0 vs. >=0 than about intermediate bits. > But an Outputstream might also overwrite this method, it is > not a final method. But most likely we want: > > write(x) does the same as > write(new byte[]{(byte)x}) > > And the above invariant wouldn't hold if we were to interpret > the upper 24-bits. Good point. But I'd think that he who intentionally violates the general contract might not care about that either. -- "I'm a doctor, not a mechanic." Dr Leonard McCoy "I'm a mechanic, not a doctor." Volker Borchert