Package nl.tudelft.simulation.dsol.animation.gis.io

## Class ObjectEndianInputStream

- java.lang.Object
- - nl.tudelft.simulation.dsol.animation.gis.io.ObjectEndianInputStream

All Implemented Interfaces:
  `DataInput`

    public class ObjectEndianInputStream
    extends Object
    implements DataInput

This class enables the object inputstream to be switched from big endian (default in Java) to little endian. The class works exactly like an ObjectInputStream.

Copyright (c) 2020-2021 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information DSOL Manual. The DSOL project is distributed under a three-clause BSD-style license, which can be found at DSOL License.

Author:
  Alexander Verbraeck

### Constructor Summary

Constructors
`ObjectEndianInputStream​(InputStream inputStream)` constructs a new ObjectEndianInputStream.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `close()`
`Endianness` `getEndianness()` Return the Endianness, i.e., big endian or little endian encoding.
`int` `read​(byte[] b)` reads b from the stream.
`int` `read​(byte[] b, int off, int len)` reads b from the stream.
`boolean` `readBoolean()`
`byte` `readByte()`
`char` `readChar()`
`double` `readDouble()`
`float` `readFloat()`
`void` `readFully​(byte[] b)`
`void` `readFully​(byte[] b, int off, int len)`
`int` `readInt()`
`String` `readLine()`
`long` `readLong()`
`short` `readShort()`
`int` `readUnsignedByte()`
`int` `readUnsignedShort()`
`String` `readUTF()`
`static String` `readUTF​(DataInput dataInput)` reads UTF from the stream.
`void` `setEndianness​(Endianness endianness)` Set the Endianness, i.e., big endian or little endian encoding.
`int` `skipBytes​(int n)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ObjectEndianInputStream

    public ObjectEndianInputStream​(InputStream inputStream)

constructs a new ObjectEndianInputStream.

Parameters:
  `inputStream` - InputStream; the inputStream to use

### Method Detail

#### readShort

    public final short readShort()
                          throws IOException

Specified by:
  `readShort` in interface `DataInput`
Throws:
  `IOException`

#### readUnsignedShort

    public final int readUnsignedShort()
                                throws IOException

Specified by:
  `readUnsignedShort` in interface `DataInput`
Throws:
  `IOException`

#### readChar

    public final char readChar()
                        throws IOException

Specified by:
  `readChar` in interface `DataInput`
Throws:
  `IOException`

#### readInt

    public final int readInt()
                      throws IOException

Specified by:
  `readInt` in interface `DataInput`
Throws:
  `IOException`

#### readLong

    public final long readLong()
                        throws IOException

Specified by:
  `readLong` in interface `DataInput`
Throws:
  `IOException`

#### readFloat

    public final float readFloat()
                          throws IOException

Specified by:
  `readFloat` in interface `DataInput`
Throws:
  `IOException`

#### readDouble

    public final double readDouble()
                            throws IOException

Specified by:
  `readDouble` in interface `DataInput`
Throws:
  `IOException`

#### read

    public final int read​(byte[] b)
                   throws IOException

reads b from the stream.

Parameters:
  `b` - byte[]; byte
Returns:
  in the value
Throws:
  `IOException` - on failure

#### read

    public final int read​(byte[] b,
                          int off,
                          int len)
                   throws IOException

reads b from the stream.

Parameters:
  `b` - byte[]; byte
  `off` - int; offset
  `len` - int; length
Returns:
  in the value
Throws:
  `IOException` - on failure

#### readFully

    public final void readFully​(byte[] b)
                         throws IOException

Specified by:
  `readFully` in interface `DataInput`
Throws:
  `IOException`

#### readFully

    public final void readFully​(byte[] b,
                                int off,
                                int len)
                         throws IOException

Specified by:
  `readFully` in interface `DataInput`
Throws:
  `IOException`

#### skipBytes

    public final int skipBytes​(int n)
                        throws IOException

Specified by:
  `skipBytes` in interface `DataInput`
Throws:
  `IOException`

#### readBoolean

    public final boolean readBoolean()
                              throws IOException

Specified by:
  `readBoolean` in interface `DataInput`
Throws:
  `IOException`

#### readByte

    public final byte readByte()
                        throws IOException

Specified by:
  `readByte` in interface `DataInput`
Throws:
  `IOException`

#### readUnsignedByte

    public final int readUnsignedByte()
                               throws IOException

Specified by:
  `readUnsignedByte` in interface `DataInput`
Throws:
  `IOException`

#### readUTF

    public final String readUTF()
                         throws IOException

Specified by:
  `readUTF` in interface `DataInput`
Throws:
  `IOException`

#### readLine

    public final String readLine()

Specified by:
  `readLine` in interface `DataInput`

#### readUTF

    public static final String readUTF​(DataInput dataInput)
                                throws IOException

reads UTF from the stream.

Parameters:
  `dataInput` - DataInput; data input
Returns:
  String the value
Throws:
  `IOException` - on read failure

#### close

    public final void close()
                     throws IOException

Throws:
  `IOException` - on close failure

#### getEndianness

    public final Endianness getEndianness()

Return the Endianness, i.e., big endian or little endian encoding.

Returns:
  Endianness; big endian or little endian encoding

#### setEndianness

    public final void setEndianness​(Endianness endianness)

Set the Endianness, i.e., big endian or little endian encoding.

Parameters:
  `endianness` - Endianness; big endian or little endian encoding