|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jcontrol.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 OutputStream
IOException
- if stream is already closedpublic void flush() throws IOException
OutputStream
flush
in class OutputStream
IOException
- occurs on I/O errors or when the stream is closedpublic void write(int b) throws IOException
DataOutputStream
write
in class DataOutputStream
b
- byte to write
IOException
- occurs on I/O errors or when the stream is closedpublic void write(byte[] b) throws IOException
DataOutputStream
write
in class DataOutputStream
b
- array containing the data to send
IOException
- occurs on I/O errors or when the stream is closedpublic void write(byte[] b, int start, int length) throws IOException
DataOutputStream
write
in class DataOutputStream
b
- 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 closedpublic void writeBoolean(boolean b) throws IOException
DataOutputStream
boolean
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 DataOutputStream
b
- boolean to write
IOException
- occurs on I/O errors or when the stream was closedpublic void writeChar(char c) throws IOException
DataOutputStream
char
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
DataOutputStream
short
to the DataOutputStream and increases the internal
byte counter by 2, the size of a short
.
writeShort
in class DataOutputStream
s
- short to write
IOException
- occurs on I/O errors or when the stream was closedpublic void writeInt(int i) throws IOException
DataOutputStream
int
to the DataOutputStream and increases the internal
byte counter by 4, the size of an int
.
writeInt
in class DataOutputStream
i
- integer to write
IOException
- occurs on I/O errors or when the stream was closedpublic void writeLong(long l) throws IOException
DataOutputStream
long
to the DataOutputStream and increases the internal
byte counter by 8, the size of a long
.
writeLong
in class DataOutputStream
l
- long to write
IOException
- occurs on I/O errors or when the stream was closedpublic void writeFloat(float f) throws IOException
DataOutputStream
float
to the DataOutputStream and increases the internal
byte counter by 4, the size of a float
.
writeFloat
in class DataOutputStream
f
- float to write
IOException
- occurs on I/O errors or when the stream was closedpublic void writeDouble(double d) throws IOException
DataOutputStream
double
to the DataOutputStream and increases the internal
byte counter by 8, the size of a double
.
writeDouble
in class DataOutputStream
d
- 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 |