Java Reference
In-Depth Information
Read
Write
Type
readFloat
writeFloat
float
readDouble
writeDouble
double
String (in UTF format)
readUTF
writeUTF
String values are read and written using a modified form of the UTF -8
character encoding. This differs from standard UTF -8 in three ways: the
null byte ( \u0000 ) is encoded in a 2-byte format so that the encoded
string does not have embedded null bytes; only 1-byte, 2-byte, or
3-byte formats are used; and supplementary characters are encoded
using surrogate pairs. Encoding Unicode characters into bytes is neces-
sary in many situations because of the continuing transition from 8-bit
to 16-bit character sets.
In addition to these paired methods, DataInput has several methods of
its own, some of which are similar to those of InputStream :
public abstract void readFully(byte[] buf, int offset, int count)
throws IOException
Reads into part of a byte array. The maximum number of
bytes read is count . The bytes are stored from buf[offset] up
to a maximum of buf[offset+count-1] . If count is zero then no
bytes are read. This method blocks until input is available, the
end of the file (that is, stream) is foundin which case an EOFEx-
ception is thrownor an exception is thrown because of an I/O
error.
 
Search WWH ::




Custom Search