The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


bytes & integers in streams

Posted by Ivan Villanueva on June 20, 2001 at 11:41 AM


In the java 1.3 I/O Systems,
I understand that the old methods write bytes (8 bits) and the new one (with Readers & Writers) write uni-code (16 bits, like characters in java). In the java documentation you can read for the old class FileOutputStream:

public void write(int b)
throws IOException
Writes the specified byte to this file output stream. Implements the write method of OutputStream.

But integers are 32 bit !!!
Can anybody get me out of this confusion ? I cannot understand how it cans write something that is 32bit in the place of a byte that is 8bit.

thanks a lot
Ivan Villanueva


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us