Package org.locationtech.jts.io
Class ByteOrderDataInStream
- java.lang.Object
-
- org.locationtech.jts.io.ByteOrderDataInStream
-
public class ByteOrderDataInStream extends java.lang.Object
Allows reading a stream of Java primitive datatypes from an underlyingInStream
, with the representation being in either common byte ordering.
-
-
Constructor Summary
Constructors Constructor Description ByteOrderDataInStream()
ByteOrderDataInStream(InStream stream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getCount()
Gets the number of bytes read from the stream.byte[]
getData()
Gets the data item that was last read from the stream.byte
readByte()
Reads a byte value.double
readDouble()
Reads a double value.int
readInt()
Reads an int value.long
readLong()
Reads a long value.void
setInStream(InStream stream)
Allows a single ByteOrderDataInStream to be reused on multiple InStreams.void
setOrder(int byteOrder)
Sets the ordering on the stream using the codes inByteOrderValues
.
-
-
-
Constructor Detail
-
ByteOrderDataInStream
public ByteOrderDataInStream()
-
ByteOrderDataInStream
public ByteOrderDataInStream(InStream stream)
-
-
Method Detail
-
setInStream
public void setInStream(InStream stream)
Allows a single ByteOrderDataInStream to be reused on multiple InStreams.- Parameters:
stream
-
-
setOrder
public void setOrder(int byteOrder)
Sets the ordering on the stream using the codes inByteOrderValues
.- Parameters:
byteOrder
- the byte order code
-
getCount
public long getCount()
Gets the number of bytes read from the stream.- Returns:
- the number of bytes read
-
getData
public byte[] getData()
Gets the data item that was last read from the stream.- Returns:
- the data last read
-
readByte
public byte readByte() throws java.io.IOException, ParseException
Reads a byte value.- Returns:
- the value read
- Throws:
java.io.IOException
- if an I/O error occurredParseException
- if not enough data could be read
-
readInt
public int readInt() throws java.io.IOException, ParseException
Reads an int value.- Returns:
- the value read
- Throws:
java.io.IOException
- if an I/O error occurredParseException
- if not enough data could be read
-
readLong
public long readLong() throws java.io.IOException, ParseException
Reads a long value.- Returns:
- the value read
- Throws:
java.io.IOException
- if an I/O error occurredParseException
- if not enough data could be read
-
readDouble
public double readDouble() throws java.io.IOException, ParseException
Reads a double value.- Returns:
- the value read
- Throws:
java.io.IOException
- if an I/O error occurredParseException
- if not enough data could be read
-
-