Package org.apache.fontbox.cff
Class DataInput
- java.lang.Object
 - 
- org.apache.fontbox.cff.DataInput
 
 
- 
- Direct Known Subclasses:
 CFFDataInput
public class DataInput extends java.lang.ObjectThis class contains some functionality to read a byte buffer.- Version:
 - $Revision$
 - Author:
 - Villu Ruusmann
 
 
- 
- 
Constructor Summary
Constructors Constructor Description DataInput(byte[] buffer)Constructor. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetPosition()Returns the current position.java.lang.StringgetString()Returns the buffer as an ISO-8859-1 string.booleanhasRemaining()Determines if there are any bytes left to read or not.intlength()bytereadByte()Read one single byte from the buffer.byte[]readBytes(int length)Read a number of single byte values from the buffer.intreadInt()Read one single int (4 bytes) from the buffer.shortreadShort()Read one single short value from the buffer.intreadUnsignedByte()Read one single unsigned byte from the buffer.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
public boolean hasRemaining()
Determines if there are any bytes left to read or not.- Returns:
 - true if there are any bytes left to read
 
 
- 
getPosition
public int getPosition()
Returns the current position.- Returns:
 - current position
 
 
- 
setPosition
public void setPosition(int position)
Sets the current position to the given value.- Parameters:
 position- the given position
 
- 
getString
public java.lang.String getString() throws java.io.IOExceptionReturns the buffer as an ISO-8859-1 string.- Returns:
 - the buffer as string
 - Throws:
 java.io.IOException- if an error occurs during reading
 
- 
readByte
public 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
public 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
 
- 
readShort
public 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
public 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
public 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
public 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
public int length()
 
 - 
 
 -