Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jcontrol.io
Class GenericDataOutputStream

    java.lang.Object
      jcontrol.io.OutputStream
          jcontrol.io.DataOutputStream
              jcontrol.io.GenericDataOutputStream

    public class GenericDataOutputStream

extends DataOutputStream

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

### m_outputStream

    protected OutputStream m_outputStream

  The underlying output stream.

### m_endianess

    protected int m_endianess

  The endianess of the stream.

### m_written

    protected int m_written

  Number of bytes written to the DataOutputStream so far.

Constructor Detail

### GenericDataOutputStream

    protected GenericDataOutputStream(OutputStream out,
                                      int endianess)

  Creates a new DataOutputStream on top of the specified OutputStream.

  Parameters:
    `out` - OutputStream to use
    `endianess` - either `BIG_ENDIAN` or `LITTLE_ENDIAN`

Method Detail

### close

    public void close()
               throws IOException

  Description copied from class: `OutputStream`
  Closes the stream.

  Specified by:
    `close` in class `OutputStream`
  Throws:
    `IOException` - if stream is already closed

### flush

    public void flush()
               throws IOException

  Description copied from class: `OutputStream`
  Flushes the stream by forcing the output of internally buffered data.

  Specified by:
    `flush` in class `OutputStream`
  Throws:
    `IOException` - occurs on I/O errors or when the stream is closed

### write

    public void write(int b)
               throws IOException

  Description copied from class: `DataOutputStream`
  Writes a single byte to the OutputStream. The internal byte counter is increased by 1.

  Specified by:
    `write` in class `DataOutputStream`
  Parameters:
    `b` - byte to write
  Throws:
    `IOException` - occurs on I/O errors or when the stream is closed

### write

    public void write(byte[] b)
               throws IOException

  Description copied from class: `DataOutputStream`
  Writes an array of bytes to the OutputStream. The internal byte counter is increased by the number of bytes written.

  Specified by:
    `write` in class `DataOutputStream`
  Parameters:
    `b` - array containing the data to send
  Throws:
    `IOException` - occurs on I/O errors or when the stream is closed

### write

    public void write(byte[] b,
                      int start,
                      int length)
               throws IOException

  Description copied from class: `DataOutputStream`
  Writes a part of an array to the OutputStream. The internal byte counter is increased by the number of bytes written.

  Specified by:
    `write` in class `DataOutputStream`
  Parameters:
    `b` - array containing the data to send
    `start` - index of the first byte to send in the array
    `length` - number of bytes to send
  Throws:
    `IOException` - occurs on I/O errors or when the stream is closed

### writeBoolean

    public void writeBoolean(boolean b)
                      throws IOException

  Description copied from class: `DataOutputStream`
  Writes a `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.

  Specified by:
    `writeBoolean` in class `DataOutputStream`
  Parameters:
    `b` - boolean to write
  Throws:
    `IOException` - occurs on I/O errors or when the stream was closed

### writeChar

    public void writeChar(char c)
                   throws IOException

  Description copied from class: `DataOutputStream`
  Writes a `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

### writeShort

    public void writeShort(short s)
                    throws IOException

  Description copied from class: `DataOutputStream`
  Writes a `short` to the DataOutputStream and increases the internal byte counter by 2, the size of a `short`.

  Specified by:
    `writeShort` in class `DataOutputStream`
  Parameters:
    `s` - short to write
  Throws:
    `IOException` - occurs on I/O errors or when the stream was closed

### writeInt

    public void writeInt(int i)
                  throws IOException

  Description copied from class: `DataOutputStream`
  Writes an `int` to the DataOutputStream and increases the internal byte counter by 4, the size of an `int`.

  Specified by:
    `writeInt` in class `DataOutputStream`
  Parameters:
    `i` - integer to write
  Throws:
    `IOException` - occurs on I/O errors or when the stream was closed

### writeLong

    public void writeLong(long l)
                   throws IOException

  Description copied from class: `DataOutputStream`
  Writes an `long` to the DataOutputStream and increases the internal byte counter by 8, the size of a `long`.

  Specified by:
    `writeLong` in class `DataOutputStream`
  Parameters:
    `l` - long to write
  Throws:
    `IOException` - occurs on I/O errors or when the stream was closed

### writeFloat

    public void writeFloat(float f)
                    throws IOException

  Description copied from class: `DataOutputStream`
  Writes an `float` to the DataOutputStream and increases the internal byte counter by 4, the size of a `float`.

  Specified by:
    `writeFloat` in class `DataOutputStream`
  Parameters:
    `f` - float to write
  Throws:
    `IOException` - occurs on I/O errors or when the stream was closed

### writeDouble

    public void writeDouble(double d)
                     throws IOException

  Description copied from class: `DataOutputStream`
  Writes an `double` to the DataOutputStream and increases the internal byte counter by 8, the size of a `double`.

  Specified by:
    `writeDouble` in class `DataOutputStream`
  Parameters:
    `d` - double to write
  Throws:
    `IOException` - occurs on I/O errors or when the stream was closed

### size

    public int size()

  Description copied from class: `DataOutputStream`
  Returns the internal byte counter.

  Specified by:
    `size` in class `DataOutputStream`
  Returns:
    byte counter

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD