|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.io.OutputStream
|
+--java.io.FilterOutputStream
|
+--java.io.DataOutputStream
This class lets you write primitive Java data types to a stream in a portable way. Primitive data types are well understood types with associated operations. For example, an Integer is considered to be a good primitive data type. The data can be converted back using a DataInputStream.
| Field Summary | |
protected int |
written
The number of bytes written so far. |
| Fields inherited from class java.io.FilterOutputStream |
out |
| Constructor Summary | |
DataOutputStream(OutputStream out)
Creates a new DataOutputStream. |
|
| Method Summary | |
void |
flush()
Flushes the stream. |
int |
size()
Returns the number of bytes written. |
void |
write(byte[] b,
int off,
int len)
Writes a sub array of bytes. |
void |
write(int b)
Writes a byte. |
void |
writeBoolean(boolean v)
Writes a boolean. |
void |
writeByte(int v)
Writes an 8 bit byte. |
void |
writeBytes(String s)
Writes a String as a sequence of bytes. |
void |
writeChar(int v)
Writes a 16 bit char. |
void |
writeChars(String s)
Writes a String as a sequence of chars. |
void |
writeDouble(double v)
Writes a 64 bit double. |
void |
writeFloat(float v)
Writes a 32 bit float. |
void |
writeInt(int v)
Writes a 32 bit int. |
void |
writeLong(long v)
Writes a 64 bit long. |
void |
writeShort(int v)
Writes a 16 bit short. |
void |
writeUTF(String str)
Writes a String in UTF format. |
| Methods inherited from class java.io.FilterOutputStream |
close, write |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.io.DataOutput |
write |
| Field Detail |
protected int written
| Constructor Detail |
public DataOutputStream(OutputStream out)
out - the output stream| Method Detail |
public void write(int b)
throws IOException
write in interface DataOutputwrite in class FilterOutputStreamb - the byte to be written
IOException - If an I/O error has occurred.
public void write(byte[] b,
int off,
int len)
throws IOException
write in interface DataOutputwrite in class FilterOutputStreamb - the data to be writtenoff - the start offset in the datalen - the number of bytes that are written
IOException - If an I/O error has occurred.
public void flush()
throws IOException
flush in class FilterOutputStreamIOException - If an I/O error has occurred.
public final void writeBoolean(boolean v)
throws IOException
writeBoolean in interface DataOutputv - the boolean to be written
IOException
public final void writeByte(int v)
throws IOException
writeByte in interface DataOutputv - the byte value to be written
IOException
public final void writeShort(int v)
throws IOException
writeShort in interface DataOutputv - the short value to be written
IOException
public final void writeChar(int v)
throws IOException
writeChar in interface DataOutputv - the char value to be written
IOException
public final void writeInt(int v)
throws IOException
writeInt in interface DataOutputv - the integer value to be written
IOException
public final void writeLong(long v)
throws IOException
writeLong in interface DataOutputv - the long value to be written
IOException
public final void writeFloat(float v)
throws IOException
writeFloat in interface DataOutputv - the float value to be written
IOException
public final void writeDouble(double v)
throws IOException
writeDouble in interface DataOutputv - the double value to be written
IOException
public final void writeBytes(String s)
throws IOException
writeBytes in interface DataOutputs - the String of bytes to be written
IOException
public final void writeChars(String s)
throws IOException
writeChars in interface DataOutputs - the String of chars to be written
IOException
public final void writeUTF(String str)
throws IOException
writeUTF in interface DataOutputstr - the String in UTF format
IOExceptionpublic final int size()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||