|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
java.io.DataInputStream
schmitzm.io.BinaryInputStream
public class BinaryInputStream
BinaryInputStream
erweitert die Klasse
java.io.DataInputStream
um Methoden, mit denen man Werte
wahlweise in BigEndian oder LittleEndian aus dem Stream
auslesen kann.DataInputStream
interpretieren
die Byte-Folgen immer als BigEndian (das erste Byte im Stream
ist das hoechstwertige Byte für den zu lesenenden Wert).
DataInputStream
Field Summary |
---|
Fields inherited from class java.io.FilterInputStream |
---|
in |
Constructor Summary | |
---|---|
BinaryInputStream(byte[] bytes)
Erzeugt einen neuen Binary-Eingabestream, in dem aus dem byte -Array ein ByteArrayInputStream
erzeugt wird. |
|
BinaryInputStream(InputStream in)
Erzeugt einen neuen Binary-Eingabestream. |
|
BinaryInputStream(String str)
Erzeugt einen neuen Binary-Eingabestream, in dem aus dem String ein ByteArrayInputStream erzeugt wird. |
Method Summary | |
---|---|
static BinaryInputStream |
fromInputStream(InputStream in)
Liefert einen InputStream als BinaryInputStream . |
char |
readChar(byte byteOrder)
Liest einen char -Wert (2 Bytes) aus dem Stream. |
double |
readDouble(byte byteOrder)
Liest einen double -Wert (8 Bytes) aus dem Stream. |
float |
readFloat(byte byteOrder)
Liest einen float -Wert (4 Bytes) aus dem Stream. |
int |
readInt(byte byteOrder)
Liest einen int -Wert (4 Bytes) aus dem Stream. |
long |
readLong(byte byteOrder)
Liest einen long -Wert (8 Bytes) aus dem Stream. |
short |
readShort(byte byteOrder)
Liest einen short -Wert (2 Bytes) aus dem Stream. |
int |
readUnsignedShort(byte byteOrder)
Liest einen short -Wert (2 Bytes) aus dem Stream, der ohne
Vorzeichen interpretiert wird. |
Methods inherited from class java.io.DataInputStream |
---|
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, readUTF, skipBytes |
Methods inherited from class java.io.FilterInputStream |
---|
available, close, mark, markSupported, read, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BinaryInputStream(InputStream in)
public BinaryInputStream(byte[] bytes)
byte
-Array ein ByteArrayInputStream
erzeugt wird.
ByteArrayInputStream
public BinaryInputStream(String str)
ByteArrayInputStream
erzeugt wird.
ByteArrayInputStream
Method Detail |
---|
public static BinaryInputStream fromInputStream(InputStream in)
InputStream
als BinaryInputStream
.
Ist der uebergebene InputStream
bereits eine Instanz von
BinaryInputStream
wird diese (gecastet) zurueckgegeben.
Ansonsten wird eine neue BinaryInputStream
-Instanz aus dem
InputStream
erzeugt.
public char readChar(byte byteOrder) throws IOException
char
-Wert (2 Bytes) aus dem Stream.
Dabei wird das 2er-Komplement verwendet.
byteOrder
- BigEndian/LittleEndian (vgl. BinaryUtil
)
IOException
BinaryUtil.XDR
,
BinaryUtil.NDR
,
BinaryUtil.convertBytesToLong(byte,InputStream,int)
public short readShort(byte byteOrder) throws IOException
short
-Wert (2 Bytes) aus dem Stream.
Dabei wird das 2er-Komplement verwendet.
byteOrder
- BigEndian/LittleEndian (vgl. BinaryUtil
)
IOException
BinaryUtil.XDR
,
BinaryUtil.NDR
,
BinaryUtil.convertBytesToLong(byte,InputStream,int)
public int readUnsignedShort(byte byteOrder) throws IOException
short
-Wert (2 Bytes) aus dem Stream, der ohne
Vorzeichen interpretiert wird. Dabei wird das 2er-Komplement verwendet.
byteOrder
- BigEndian/LittleEndian (vgl. BinaryUtil
)
IOException
BinaryUtil.XDR
,
BinaryUtil.NDR
,
BinaryUtil.convertBytesToLong(byte,InputStream,int)
public int readInt(byte byteOrder) throws IOException
int
-Wert (4 Bytes) aus dem Stream.
Dabei wird das 2er-Komplement verwendet.
byteOrder
- BigEndian/LittleEndian (vgl. BinaryUtil
)
IOException
BinaryUtil.XDR
,
BinaryUtil.NDR
,
BinaryUtil.convertBytesToLong(byte,InputStream,int)
public long readLong(byte byteOrder) throws IOException
long
-Wert (8 Bytes) aus dem Stream.
Dabei wird das 2er-Komplement verwendet.
byteOrder
- BigEndian/LittleEndian (vgl. BinaryUtil
)
IOException
BinaryUtil.XDR
,
BinaryUtil.NDR
,
BinaryUtil.convertBytesToLong(byte,InputStream,int)
public double readDouble(byte byteOrder) throws IOException
double
-Wert (8 Bytes) aus dem Stream.
byteOrder
- BigEndian/LittleEndian (vgl. BinaryUtil
)
IOException
BinaryUtil.XDR
,
BinaryUtil.NDR
,
BinaryUtil.convertBytesToDouble(byte,InputStream)
public float readFloat(byte byteOrder) throws IOException
float
-Wert (4 Bytes) aus dem Stream.
byteOrder
- BigEndian/LittleEndian (vgl. BinaryUtil
)
IOException
BinaryUtil.XDR
,
BinaryUtil.NDR
,
BinaryUtil.convertBytesToFloat(byte,InputStream)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |