Possible Duplicate:
Why Java OutputStream.write() Takes Integer but Writes Bytes
Why does the write()
method of the OutputStream
class take an integer instead of a byte when it actually writes data byte by byte?
it is consistent w/ IntputStream.read()
and since most operations (sum, mul, div, etc) are promoted to int, it removes the need to constantly cast to byte
.
I think it's ok.
It actually writes a single byte from that int (the 8 low-order bits). See the documentation: http://docs.oracle.com/javase/1.4.2/docs/api/java/io/OutputStream.html#write%28int%29
Edit: I did some digging and found this: Why Java OutputStream.write() Takes Integer but Writes Bytes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With