Package org.apache.fontbox.cff
Class DataInputByteArray
java.lang.Object
org.apache.fontbox.cff.DataInputByteArray
- All Implemented Interfaces:
DataInput
This class implements the DataInput interface using a byte buffer as source.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the current position.booleanDetermines if there are any bytes left to read or not.intlength()intpeekUnsignedByte(int offset) Peeks one single unsigned byte from the buffer.bytereadByte()Read one single byte from the buffer.byte[]readBytes(int length) Read a number of single byte values from the buffer.intRead one single unsigned byte from the buffer.voidsetPosition(int position) Sets the current position to the given value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.fontbox.cff.DataInput
readInt, readOffset, readShort, readUnsignedShort
-
Field Details
-
inputBuffer
private final byte[] inputBuffer -
bufferPosition
private int bufferPosition
-
-
Constructor Details
-
DataInputByteArray
public DataInputByteArray(byte[] buffer) Constructor.- Parameters:
buffer- the buffer to be read
-
-
Method Details
-
hasRemaining
Determines if there are any bytes left to read or not.- Specified by:
hasRemainingin interfaceDataInput- Returns:
- true if there are any bytes left to read
- Throws:
IOException- if an error occurs during reading
-
getPosition
public int getPosition()Returns the current position.- Specified by:
getPositionin interfaceDataInput- Returns:
- current position
-
setPosition
Sets the current position to the given value.- Specified by:
setPositionin interfaceDataInput- Parameters:
position- the given position- Throws:
IOException- if the new position ist out of range
-
readByte
Read one single byte from the buffer.- Specified by:
readBytein interfaceDataInput- Returns:
- the byte
- Throws:
IOException- if an error occurs during reading
-
readUnsignedByte
Read one single unsigned byte from the buffer.- Specified by:
readUnsignedBytein interfaceDataInput- Returns:
- the unsigned byte as int
- Throws:
IOException- if an error occurs during reading
-
peekUnsignedByte
Peeks one single unsigned byte from the buffer.- Specified by:
peekUnsignedBytein interfaceDataInput- Parameters:
offset- offset to the byte to be peeked- Returns:
- the unsigned byte as int
- Throws:
IOException- if an error occurs during reading
-
readBytes
Read a number of single byte values from the buffer.- Specified by:
readBytesin interfaceDataInput- Parameters:
length- the number of bytes to be read- Returns:
- an array with containing the bytes from the buffer
- Throws:
IOException- if an error occurs during reading
-
length
- Specified by:
lengthin interfaceDataInput- Throws:
IOException
-