Package org.apache.fontbox.cff
Interface DataInput
-
- All Known Implementing Classes:
DataInputByteArray,DataInputRandomAccessRead
public interface DataInputThis interface defines some functionality to read a CFF font.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description intgetPosition()Returns the current position.booleanhasRemaining()Determines 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.default intreadInt()Read one single int (4 bytes) from the buffer.default intreadOffset(int offSize)Read the offset from the buffer.default shortreadShort()Read one single short value from the buffer.intreadUnsignedByte()Read one single unsigned byte from the buffer.default intreadUnsignedShort()Read one single unsigned short (2 bytes) value from the buffer.voidsetPosition(int position)Sets the current position to the given value.
-
-
-
Method Detail
-
hasRemaining
boolean hasRemaining() throws java.io.IOExceptionDetermines if there are any bytes left to read or not.- Returns:
- true if there are any bytes left to read
- Throws:
java.io.IOException- if an error occurs during reading
-
getPosition
int getPosition() throws java.io.IOExceptionReturns the current position.- Returns:
- current position
- Throws:
java.io.IOException- if an error occurs during reading
-
setPosition
void setPosition(int position) throws java.io.IOExceptionSets the current position to the given value.- Parameters:
position- the given position- Throws:
java.io.IOException- if the new position ist out of range
-
readByte
byte readByte() throws java.io.IOExceptionRead one single byte from the buffer.- Returns:
- the byte
- Throws:
java.io.IOException- if an error occurs during reading
-
readUnsignedByte
int readUnsignedByte() throws java.io.IOExceptionRead one single unsigned byte from the buffer.- Returns:
- the unsigned byte as int
- Throws:
java.io.IOException- if an error occurs during reading
-
peekUnsignedByte
int peekUnsignedByte(int offset) throws java.io.IOExceptionPeeks one single unsigned byte from the buffer.- Parameters:
offset- offset to the byte to be peeked- Returns:
- the unsigned byte as int
- Throws:
java.io.IOException- if an error occurs during reading
-
readShort
default short readShort() throws java.io.IOExceptionRead one single short value from the buffer.- Returns:
- the short value
- Throws:
java.io.IOException- if an error occurs during reading
-
readUnsignedShort
default int readUnsignedShort() throws java.io.IOExceptionRead one single unsigned short (2 bytes) value from the buffer.- Returns:
- the unsigned short value as int
- Throws:
java.io.IOException- if an error occurs during reading
-
readInt
default int readInt() throws java.io.IOExceptionRead one single int (4 bytes) from the buffer.- Returns:
- the int value
- Throws:
java.io.IOException- if an error occurs during reading
-
readBytes
byte[] readBytes(int length) throws java.io.IOExceptionRead a number of single byte values from the buffer.- Parameters:
length- the number of bytes to be read- Returns:
- an array with containing the bytes from the buffer
- Throws:
java.io.IOException- if an error occurs during reading
-
length
int length() throws java.io.IOException- Throws:
java.io.IOException
-
readOffset
default int readOffset(int offSize) throws java.io.IOExceptionRead the offset from the buffer.- Parameters:
offSize- the given offsize- Returns:
- the offset
- Throws:
java.io.IOException- if an error occurs during reading
-
-