DataOutput
interface provides
for converting data from any of the Java
primitive types to a series of bytes and
writing these bytes to a binary stream.
There is also a facility for converting
a String
into
modified UTF-8
format and writing the resulting series
of bytes.
For all the methods in this interface that
write bytes, it is generally true that if
a byte cannot be written for any reason,
an IOException
is thrown.
java.io.DataInput
, java.io.DataOutputStream
Modifier and Type | Method and Description |
---|---|
public void | write(int
the byte to be written. b)Writes to the output stream the eight
low-order bits of the argument |
public void | |
public void | write(byte[]
the data. b, int the start offset in the data. off, int the number of bytes to write. len)Writes |
public void | |
public void | writeByte(int
the byte value to be written. v)Writes to the output stream the eight low-order
bits of the argument |
public void | |
public void | writeChar(int
the v)char value to be written.Writes a |
public void | writeChars(String
the string value to be written. s)Writes every character in the string |
public void | writeDouble(double
the v)double value to be written.Writes a |
public void | writeFloat(float
the v)float value to be written.Writes a |
public void | writeInt(int
the v)int value to be written.Writes an |
public void | writeLong(long
the v)long value to be written.Writes a |
public void | writeShort(int
the v)short value to be written.Writes two bytes to the output stream to represent the value of the argument. |
public void | writeUTF(String
the string value to be written. s)Writes two bytes of length information
to the output stream, followed
by the
modified UTF-8
representation
of every character in the string |
write | back to summary |
---|---|
public void write(int b) throws IOException Writes to the output stream the eight
low-order bits of the argument
|
write | back to summary |
---|---|
public void write(byte[] b) throws IOException Writes to the output stream all the bytes in array
|
write | back to summary |
---|---|
public void write(byte[] b, int off, int len) throws IOException Writes
|
writeBoolean | back to summary |
---|---|
public void writeBoolean(boolean v) throws IOException Writes a
|
writeByte | back to summary |
---|---|
public void writeByte(int v) throws IOException Writes to the output stream the eight low-order
bits of the argument
|
writeBytes | back to summary |
---|---|
public void writeBytes(String s) throws IOException Writes a string to the output stream.
For every character in the string
If
|
writeChar | back to summary |
---|---|
public void writeChar(int v) throws IOException Writes a
The bytes written by this method may be
read by the
|
writeChars | back to summary |
---|---|
public void writeChars(String s) throws IOException Writes every character in the string
|
writeDouble | back to summary |
---|---|
public void writeDouble(double v) throws IOException Writes a
|
writeFloat | back to summary |
---|---|
public void writeFloat(float v) throws IOException Writes a
|
writeInt | back to summary |
---|---|
public void writeInt(int v) throws IOException Writes an
The bytes written by this method may be read
by the
|
writeLong | back to summary |
---|---|
public void writeLong(long v) throws IOException Writes a
The bytes written by this method may be
read by the
|
writeShort | back to summary |
---|---|
public void writeShort(int v) throws IOException Writes two bytes to the output stream to represent the value of the argument. The byte values to be written, in the order shown, are:
The bytes written by this method may be
read by the
|
writeUTF | back to summary |
---|---|
public void writeUTF(String s) throws IOException Writes two bytes of length information
to the output stream, followed
by the
modified UTF-8
representation
of every character in the string
If a character (byte)c
If a character If a character
First,
the total number of bytes needed to represent
all the characters of The
bytes written by this method may be read
by the
|