|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjcontrol.io.OutputStream
jcontrol.io.DataOutputStream
jcontrol.io.GenericDataOutputStream
public class GenericDataOutputStream
A DataOutputStreams allows the output of java basic types (char, short, int, boolean) to any OutputStream.
| Field Summary | |
|---|---|
protected int |
m_endianess
The endianess of the stream. |
protected OutputStream |
m_outputStream
The underlying output stream. |
protected int |
m_written
Number of bytes written to the DataOutputStream so far. |
| Fields inherited from class jcontrol.io.DataOutputStream |
|---|
BIG_ENDIAN, LITTLE_ENDIAN |
| Constructor Summary | |
|---|---|
protected |
GenericDataOutputStream(OutputStream out,
int endianess)
Creates a new DataOutputStream on top of the specified OutputStream. |
| Method Summary | |
|---|---|
void |
close()
Closes the stream. |
void |
flush()
Flushes the stream by forcing the output of internally buffered data. |
int |
size()
Returns the internal byte counter. |
void |
write(byte[] b)
Writes an array of bytes to the OutputStream. |
void |
write(byte[] b,
int start,
int length)
Writes a part of an array to the OutputStream. |
void |
write(int b)
Writes a single byte to the OutputStream. |
void |
writeBoolean(boolean b)
Writes a boolean to the DataOutputStream. |
void |
writeChar(char c)
Writes a char to the DataOutputStream and increases the internal
byte counter by 2, the size of a char. |
void |
writeDouble(double d)
Writes an double to the DataOutputStream and increases the internal
byte counter by 8, the size of a double. |
void |
writeFloat(float f)
Writes an float to the DataOutputStream and increases the internal
byte counter by 4, the size of a float. |
void |
writeInt(int i)
Writes an int to the DataOutputStream and increases the internal
byte counter by 4, the size of an int. |
void |
writeLong(long l)
Writes an long to the DataOutputStream and increases the internal
byte counter by 8, the size of a long. |
void |
writeShort(short s)
Writes a short to the DataOutputStream and increases the internal
byte counter by 2, the size of a short. |
| Methods inherited from class jcontrol.io.DataOutputStream |
|---|
createDataOutputStream, createDataOutputStream |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, notifyAll, toString, wait |
| Field Detail |
|---|
protected OutputStream m_outputStream
protected int m_endianess
protected int m_written
| Constructor Detail |
|---|
protected GenericDataOutputStream(OutputStream out,
int endianess)
out - OutputStream to useendianess - either BIG_ENDIAN or LITTLE_ENDIAN| Method Detail |
|---|
public void close()
throws IOException
OutputStream
close in class OutputStreamIOException - if stream is already closed
public void flush()
throws IOException
OutputStream
flush in class OutputStreamIOException - occurs on I/O errors or when the stream is closed
public void write(int b)
throws IOException
DataOutputStream
write in class DataOutputStreamb - byte to write
IOException - occurs on I/O errors or when the stream is closed
public void write(byte[] b)
throws IOException
DataOutputStream
write in class DataOutputStreamb - array containing the data to send
IOException - occurs on I/O errors or when the stream is closed
public void write(byte[] b,
int start,
int length)
throws IOException
DataOutputStream
write in class DataOutputStreamb - array containing the data to sendstart - index of the first byte to send in the arraylength - number of bytes to send
IOException - occurs on I/O errors or when the stream is closed
public void writeBoolean(boolean b)
throws IOException
DataOutputStreamboolean to the DataOutputStream. The boolean is represented
as a byte value of 0 (false) or 1 (true). The internal
byte counter is increased by 1.
writeBoolean in class DataOutputStreamb - boolean to write
IOException - occurs on I/O errors or when the stream was closed
public void writeChar(char c)
throws IOException
DataOutputStreamchar to the DataOutputStream and increases the internal
byte counter by 2, the size of a char.
- Specified by:
writeChar in class DataOutputStream
- Parameters:
c - character to write
- Throws:
IOException - occurs on I/O errors or when the stream was closed
public void writeShort(short s)
throws IOException
DataOutputStreamshort to the DataOutputStream and increases the internal
byte counter by 2, the size of a short.
writeShort in class DataOutputStreams - short to write
IOException - occurs on I/O errors or when the stream was closed
public void writeInt(int i)
throws IOException
DataOutputStreamint to the DataOutputStream and increases the internal
byte counter by 4, the size of an int.
writeInt in class DataOutputStreami - integer to write
IOException - occurs on I/O errors or when the stream was closed
public void writeLong(long l)
throws IOException
DataOutputStreamlong to the DataOutputStream and increases the internal
byte counter by 8, the size of a long.
writeLong in class DataOutputStreaml - long to write
IOException - occurs on I/O errors or when the stream was closed
public void writeFloat(float f)
throws IOException
DataOutputStreamfloat to the DataOutputStream and increases the internal
byte counter by 4, the size of a float.
writeFloat in class DataOutputStreamf - float to write
IOException - occurs on I/O errors or when the stream was closed
public void writeDouble(double d)
throws IOException
DataOutputStreamdouble to the DataOutputStream and increases the internal
byte counter by 8, the size of a double.
writeDouble in class DataOutputStreamd - double to write
IOException - occurs on I/O errors or when the stream was closedpublic int size()
DataOutputStream
size in class DataOutputStream
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||