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

## com.mindprod.ledatastream
Class LEDataOutputStream

    java.lang.Object
      com.mindprod.ledatastream.LEDataOutputStream

All Implemented Interfaces:
  java.io.DataOutput

    public final class LEDataOutputStream

extends java.lang.Object
implements java.io.DataOutput

Little-endian version of DataOutputStream.

Very similar to DataOutputStream except it writes little-endian instead of big-endian binary data. We can't extend DataOutputStream directly since it has only final methods. This forces us implement LEDataOutputStream with a DataOutputStream object, and use wrapper methods.

Since:
  1998-01-06
Version:
  1.8 2007-05-24
Author:
  Roedy Green, Canadian Mind Products

Field Summary
`protected java.io.DataOutputStream` | `dis` to get at big-Endian write methods of DataOutPutStream.
`protected byte[]` | `work` work array for composing output.

Constructor Summary
`LEDataOutputStream(java.io.OutputStream out)` constructor.

Method Summary
`void` | `close()` Close stream.
`void` | `flush()` Flush stream without closing.
`int` | `size()` Get size of stream.
`void` | `write(byte[] ba)` Write out an array of bytes.
`void` | `write(byte[] ba, int off, int len)` Writes out part of an array of bytes.
`void` | `write(int ib)` This method writes only one byte, even though it says int (non-Javadoc)
`void` | `writeBoolean(boolean v)` Write a booleans as one byte.
`void` | `writeByte(int v)` write a byte.
`void` | `writeBytes(java.lang.String s)` Write a string.
`void` | `writeChar(int v)` Write a char.
`void` | `writeChars(java.lang.String s)` Write a string, not a char[].
`void` | `writeDouble(double v)` Write a double.
`void` | `writeFloat(float v)` Write a float.
`void` | `writeInt(int v)` Write an int, 32-bits.
`void` | `writeLong(long v)` Write a long, 64-bits.
`void` | `writeShort(int v)` Write short, 16-bits.
`void` | `writeUTF(java.lang.String s)` Write a string as a UTF counted string.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### dis

    protected final java.io.DataOutputStream dis

  to get at big-Endian write methods of DataOutPutStream.

### work

    protected final byte[] work

  work array for composing output.

Constructor Detail

### LEDataOutputStream

    public LEDataOutputStream(java.io.OutputStream out)

  constructor.

  Parameters:
    `out` - the outputstream we write little endian binary data onto.

Method Detail

### close

    public final void close()
                     throws java.io.IOException

  Close stream.

  Throws:
    `java.io.IOException` - if close fails.

### flush

    public void flush()
               throws java.io.IOException

  Flush stream without closing.

  Throws:
    `java.io.IOException` - if flush fails.

### size

    public final int size()

  Get size of stream.

  Returns:
    bytes written so far in the stream. Note this is a int, not a long as you would exect. This because the underlying DataInputStream has a design flaw.

### write

    public final void write(int ib)
                     throws java.io.IOException

  This method writes only one byte, even though it says int (non-Javadoc)

  Specified by:
    `write` in interface `java.io.DataOutput`
  Parameters:
    `ib` - the byte to write.
  Throws:
    `java.io.IOException` - if write fails.
  See Also:
    `DataOutput.write(int)`

### write

    public final void write(byte[] ba)
                     throws java.io.IOException

  Write out an array of bytes.

  Specified by:
    `write` in interface `java.io.DataOutput`
  Throws:
    `java.io.IOException` - if write fails.
  See Also:
    `DataOutput.write(byte[])`

### write

    public final void write(byte[] ba,
                            int off,
                            int len)
                     throws java.io.IOException

  Writes out part of an array of bytes.

  Specified by:
    `write` in interface `java.io.DataOutput`
  Throws:
    `java.io.IOException` - if write fails.
  See Also:
    `DataOutput.write(byte[],int,int)`

### writeBoolean

    public final void writeBoolean(boolean v)
                            throws java.io.IOException

  Write a booleans as one byte.

  Specified by:
    `writeBoolean` in interface `java.io.DataOutput`
  Parameters:
    `v` - boolean to write.
  Throws:
    `java.io.IOException` - if write fails.
  See Also:
    `DataOutput.writeBoolean(boolean)`

### writeByte

    public final void writeByte(int v)
                         throws java.io.IOException

  write a byte.

  Specified by:
    `writeByte` in interface `java.io.DataOutput`
  Parameters:
    `v` - the byte to write.
  Throws:
    `java.io.IOException` - if write fails.
  See Also:
    `DataOutput.writeByte(int)`

### writeBytes

    public final void writeBytes(java.lang.String s)
                          throws java.io.IOException

  Write a string.

  Specified by:
    `writeBytes` in interface `java.io.DataOutput`
  Parameters:
    `s` - the string to write.
  Throws:
    `java.io.IOException` - if write fails.
  See Also:
    `DataOutput.writeBytes(java.lang.String)`

### writeChar

    public final void writeChar(int v)
                         throws java.io.IOException

  Write a char. Like DataOutputStream.writeChar. Note the parm is an int even though this as a writeChar

  Specified by:
    `writeChar` in interface `java.io.DataOutput`
  Parameters:
    `v` - the char to write
  Throws:
    `java.io.IOException` - if write fails.

### writeChars

    public final void writeChars(java.lang.String s)
                          throws java.io.IOException

  Write a string, not a char[]. Like DataOutputStream.writeChars, flip endianness of each char.

  Specified by:
    `writeChars` in interface `java.io.DataOutput`
  Throws:
    `java.io.IOException` - if write fails.

### writeDouble

    public final void writeDouble(double v)
                           throws java.io.IOException

  Write a double.

  Specified by:
    `writeDouble` in interface `java.io.DataOutput`
  Parameters:
    `v` - the double to write. Like DataOutputStream.writeDouble.
  Throws:
    `java.io.IOException` - if write fails.

### writeFloat

    public final void writeFloat(float v)
                          throws java.io.IOException

  Write a float. Like DataOutputStream.writeFloat.

  Specified by:
    `writeFloat` in interface `java.io.DataOutput`
  Parameters:
    `v` - the float to write.
  Throws:
    `java.io.IOException` - if write fails.

### writeInt

    public final void writeInt(int v)
                        throws java.io.IOException

  Write an int, 32-bits. Like DataOutputStream.writeInt.

  Specified by:
    `writeInt` in interface `java.io.DataOutput`
  Parameters:
    `v` - the int to write
  Throws:
    `java.io.IOException` - if write fails.

### writeLong

    public final void writeLong(long v)
                         throws java.io.IOException

  Write a long, 64-bits. like DataOutputStream.writeLong.

  Specified by:
    `writeLong` in interface `java.io.DataOutput`
  Parameters:
    `v` - the long to write
  Throws:
    `java.io.IOException` - if write fails.

### writeShort

    public final void writeShort(int v)
                          throws java.io.IOException

  Write short, 16-bits. Like DataOutputStream.writeShort. also acts as a writeUnsignedShort

  Specified by:
    `writeShort` in interface `java.io.DataOutput`
  Parameters:
    `v` - the short you want written in little endian binary format
  Throws:
    `java.io.IOException` - if write fails.

### writeUTF

    public final void writeUTF(java.lang.String s)
                        throws java.io.IOException

  Write a string as a UTF counted string.

  Specified by:
    `writeUTF` in interface `java.io.DataOutput`
  Parameters:
    `s` - the string to write.
  Throws:
    `java.io.IOException` - if write fails.
  See Also:
    `DataOutput.writeUTF(java.lang.String)`

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