DataOutputStream

public class DataOutputStream extends FilterOutputStream
implements DataOutput

Wraps an existing OutputStream and writes big-endian typed data to it. Typically, this stream can be read in by DataInputStream. Types that can be written include byte, 16-bit short, 32-bit int, 32-bit float, 64-bit long, 64-bit double, byte strings, and MUTF-8 encoded strings.

See Also

Field Summary

protected int written The number of bytes written out so far.

Inherited Field Summary

Public Constructor Summary

DataOutputStream(OutputStream out)
Constructs a new DataOutputStream on the OutputStream out.

Public Method Summary

void
flush()
Flushes this stream to ensure all pending data is sent out to the target stream.
final int
size()
Returns the total number of bytes written to the target stream so far.
void
write(byte[] buffer, int offset, int count)
Writes count bytes from the byte array buffer starting at offset to the target stream.
void
write(int oneByte)
Writes a byte to the target stream.
final void
writeBoolean(boolean val)
Writes a boolean to the target stream.
final void
writeByte(int val)
Writes an 8-bit byte to the target stream.
final void
writeBytes(String str)
Writes the low order 8-bit bytes from the specified string.
final void
writeChar(int val)
Writes the specified 16-bit character in big-endian order.
final void
writeChars(String str)
Writes the 16-bit characters contained in str in big-endian order.
final void
writeDouble(double val)
Writes the specified 64-bit double in big-endian order.
final void
writeFloat(float val)
Writes the specified 32-bit float in big-endian order.
final void
writeInt(int val)
Writes the specified 32-bit int in big-endian order.
final void
writeLong(long val)
Writes the specified 64-bit long in big-endian order.
final void
writeShort(int val)
Writes the specified 16-bit short in big-endian order.
final void
writeUTF(String str)
Writes the specified string encoded in modified UTF-8.

Inherited Method Summary