A DataOutputStream is not safe for use by multiple concurrent threads. If a DataOutputStream is to be used by more than one thread then access to the data output stream should be controlled by appropriate synchronization.
java.io.DataInputStream
Modifier and Type | Field and Description |
---|---|
private byte[] | bytearr
bytearr is initialized on demand by writeUTF |
private static final JavaLangAccess | |
private final byte[] | |
protected int | written
The number of bytes written to the data output stream so far. |
Access | Constructor and Description |
---|---|
public | DataOutputStream(OutputStream
the underlying output stream, to be saved for later
use. out)Creates a new data output stream to write data to the specified underlying output stream. |
Modifier and Type | Method and Description |
---|---|
public void | flush()
Overrides java. Implements java. Flushes this data output stream. |
private void | incCount(int value)
Increases the written counter by the specified value until it reaches Integer.MAX_VALUE. |
public final int | Returns: the value of thewritten field.Returns the current value of the counter |
private static String | |
public synchronized void | write(int
the b)byte to be written.Overrides java. Implements java. Writes the specified byte (the low eight bits of the argument
|
public synchronized void | write(byte[]
the data. b, int the start offset in the data. off, int the number of bytes to write. len)Overrides java. Implements java. Writes |
public final void | writeBoolean(boolean
a v)boolean value to be written.Implements java. Writes a |
public final void | writeByte(int
a v)byte value to be written.Implements java. Writes out a |
public final void | writeBytes(String
a string of bytes to be written. s)Implements java. Writes out the string to the underlying output stream as a sequence of bytes. |
public final void | writeChar(int
a v)char value to be written.Implements java. Writes a |
public final void | writeChars(String
a s)String value to be written.Implements java. Writes a string to the underlying output stream as a sequence of characters. |
public final void | writeDouble(double
a v)double value to be written.Implements java. Converts the double argument to a |
public final void | writeFloat(float
a v)float value to be written.Implements java. Converts the float argument to an |
public final void | writeInt(int
an v)int to be written.Implements java. Writes an |
public final void | writeLong(long
a v)long to be written.Implements java. Writes a |
public final void | writeShort(int
a v)short to be written.Implements java. Writes a |
public final void | writeUTF(String
a string to be written. str)Implements java. Writes a string to the underlying output stream using modified UTF-8 encoding in a machine-independent manner. |
pack-priv static int | Returns: The number of bytes written out.a string to be written. str, DataOutput destination to write to out)Writes a string to the specified DataOutput using modified UTF-8 encoding in a machine-independent manner. |
bytearr | back to summary |
---|---|
private byte[] bytearr bytearr is initialized on demand by writeUTF |
JLA | back to summary |
---|---|
private static final JavaLangAccess JLA |
writeBuffer | back to summary |
---|---|
private final byte[] writeBuffer |
written | back to summary |
---|---|
protected int written The number of bytes written to the data output stream so far. If this counter overflows, it will be wrapped to Integer.MAX_VALUE. |
DataOutputStream | back to summary |
---|---|
public DataOutputStream(OutputStream out) Creates a new data output stream to write data to the specified
underlying output stream. The counter
|
flush | back to summary |
---|---|
public void flush() throws IOException Overrides java. Implements java. Flushes this data output stream. This forces any buffered output bytes to be written out to the stream.
The
|
incCount | back to summary |
---|---|
private void incCount(int value) Increases the written counter by the specified value until it reaches Integer.MAX_VALUE. |
size | back to summary |
---|---|
public final int size() Returns the current value of the counter
|
tooLongMsg | back to summary |
---|---|
private static String tooLongMsg(String s, int bits32) |
write | back to summary |
---|---|
public synchronized void write(int b) throws IOException Overrides java. Implements java. Writes the specified byte (the low eight bits of the argument
Implements the
|
write | back to summary |
---|---|
public synchronized void write(byte[] b, int off, int len) throws IOException Overrides java. Implements java. Writes
|
writeBoolean | back to summary |
---|---|
public final void writeBoolean(boolean v) throws IOException Implements java. Writes a
|
writeByte | back to summary |
---|---|
public final void writeByte(int v) throws IOException Implements java. Writes out a
|
writeBytes | back to summary |
---|---|
public final void writeBytes(String s) throws IOException Implements java. Writes out the string to the underlying output stream as a
sequence of bytes. Each character in the string is written out, in
sequence, by discarding its high eight bits. If no exception is
thrown, the counter
|
writeChar | back to summary |
---|---|
public final void writeChar(int v) throws IOException Implements java. Writes a
|
writeChars | back to summary |
---|---|
public final void writeChars(String s) throws IOException Implements java. Writes a string to the underlying output stream as a sequence of
characters. Each character is written to the data output stream as
if by the
|
writeDouble | back to summary |
---|---|
public final void writeDouble(double v) throws IOException Implements java. Converts the double argument to a
|
writeFloat | back to summary |
---|---|
public final void writeFloat(float v) throws IOException Implements java. Converts the float argument to an
|
writeInt | back to summary |
---|---|
public final void writeInt(int v) throws IOException Implements java. Writes an
|
writeLong | back to summary |
---|---|
public final void writeLong(long v) throws IOException Implements java. Writes a
|
writeShort | back to summary |
---|---|
public final void writeShort(int v) throws IOException Implements java. Writes a
|
writeUTF | back to summary |
---|---|
public final void writeUTF(String str) throws IOException Implements java. Writes a string to the underlying output stream using modified UTF-8 encoding in a machine-independent manner.
First, two bytes are written to the output stream as if by the
|
writeUTF | back to summary |
---|---|
pack-priv static int writeUTF(String str, DataOutput out) throws IOException Writes a string to the specified DataOutput using modified UTF-8 encoding in a machine-independent manner.
First, two bytes are written to out as if by the
|