public class RandomAccessFileOrArray extends Object implements DataInput
| Constructor and Description |
|---|
RandomAccessFileOrArray(byte[] arrayIn)
Deprecated.
|
RandomAccessFileOrArray(InputStream is)
Deprecated.
|
RandomAccessFileOrArray(RandomAccessFileOrArray source)
Deprecated.
use
createView() instead |
RandomAccessFileOrArray(RandomAccessSource byteSource)
Creates a RandomAccessFileOrArray that wraps the specified byte source.
|
RandomAccessFileOrArray(String filename)
Deprecated.
use
RandomAccessFileOrArray(RandomAccessSource) instead |
RandomAccessFileOrArray(String filename,
boolean forceRead,
boolean plainRandomAccess)
Deprecated.
|
RandomAccessFileOrArray(URL url)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
RandomAccessSource |
createSourceView() |
RandomAccessFileOrArray |
createView()
Creates an independent view of this object (with it's own file pointer and pushback queue).
|
protected RandomAccessSource |
getByteSource()
Deprecated.
|
long |
getFilePointer() |
long |
length() |
void |
pushBack(byte b)
Pushes a byte back.
|
int |
read()
Reads a single byte
|
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
boolean |
readBoolean() |
byte |
readByte() |
char |
readChar() |
char |
readCharLE()
Reads a Unicode character from this stream in little-endian order.
|
double |
readDouble() |
double |
readDoubleLE() |
float |
readFloat() |
float |
readFloatLE() |
void |
readFully(byte[] b) |
void |
readFully(byte[] b,
int off,
int len) |
int |
readInt() |
int |
readIntLE()
Reads a signed 32-bit integer from this stream in little-endian order.
|
String |
readLine() |
long |
readLong() |
long |
readLongLE() |
short |
readShort() |
short |
readShortLE()
Reads a signed 16-bit number from this stream in little-endian order.
|
String |
readString(int length,
String encoding)
Reads a
String from the font file as bytes using the given
encoding. |
int |
readUnsignedByte() |
long |
readUnsignedInt()
Reads an unsigned 32-bit integer from this stream.
|
long |
readUnsignedIntLE() |
int |
readUnsignedShort() |
int |
readUnsignedShortLE()
Reads an unsigned 16-bit number from this stream in little-endian order.
|
String |
readUTF() |
void |
reOpen()
Deprecated.
|
void |
seek(long pos) |
long |
skip(long n) |
int |
skipBytes(int n) |
@Deprecated public RandomAccessFileOrArray(String filename) throws IOException
RandomAccessFileOrArray(RandomAccessSource) insteadfilename - IOException@Deprecated public RandomAccessFileOrArray(RandomAccessFileOrArray source)
createView() insteadsource - the source for the new independent viewpublic RandomAccessFileOrArray(RandomAccessSource byteSource)
byteSource - the byte source to wrap@Deprecated public RandomAccessFileOrArray(String filename, boolean forceRead, boolean plainRandomAccess) throws IOException
RandomAccessSourceFactory.createBestSource(String) and RandomAccessFileOrArray(RandomAccessSource) insteadfilename - the file to open (can be a file system file or one of the following url strings: file://, http://, https://, jar:, wsjar:, vfszip:forceRead - if true, the entire file will be read into memoryplainRandomAccess - if true, a regular RandomAccessFile is used to access the file contents. If false, a memory mapped file will be used, unless the file cannot be mapped into memory, in which case regular RandomAccessFile will be usedIOException - if there is a failure opening or reading the file@Deprecated public RandomAccessFileOrArray(URL url) throws IOException
RandomAccessSourceFactory.createSource(URL) and RandomAccessFileOrArray(RandomAccessSource) insteadurl - IOException@Deprecated public RandomAccessFileOrArray(InputStream is) throws IOException
RandomAccessSourceFactory.createSource(InputStream) and RandomAccessFileOrArray(RandomAccessSource) insteadis - IOException@Deprecated public RandomAccessFileOrArray(byte[] arrayIn)
RandomAccessSourceFactory.createSource(byte[]) and RandomAccessFileOrArray(RandomAccessSource) insteadarrayIn - byte[]IOExceptionpublic RandomAccessFileOrArray createView()
public RandomAccessSource createSourceView()
@Deprecated protected RandomAccessSource getByteSource()
public void pushBack(byte b)
b - the byte to pushpublic int read()
throws IOException
IOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
IOExceptionpublic int read(byte[] b)
throws IOException
IOExceptionpublic void readFully(byte[] b)
throws IOException
readFully in interface DataInputIOExceptionpublic void readFully(byte[] b,
int off,
int len)
throws IOException
readFully in interface DataInputIOExceptionpublic long skip(long n)
throws IOException
IOExceptionpublic int skipBytes(int n)
throws IOException
skipBytes in interface DataInputIOException@Deprecated public void reOpen() throws IOException
IOExceptionpublic void close()
throws IOException
IOExceptionpublic long length()
throws IOException
IOExceptionpublic void seek(long pos)
throws IOException
IOExceptionpublic long getFilePointer()
throws IOException
IOExceptionpublic boolean readBoolean()
throws IOException
readBoolean in interface DataInputIOExceptionpublic byte readByte()
throws IOException
readByte in interface DataInputIOExceptionpublic int readUnsignedByte()
throws IOException
readUnsignedByte in interface DataInputIOExceptionpublic short readShort()
throws IOException
readShort in interface DataInputIOExceptionpublic final short readShortLE()
throws IOException
b1 and b2, where each of the two values is
between 0 and 255, inclusive, then the
result is equal to:
(short)((b2 << 8) | b1)
This method blocks until the two bytes are read, the end of the stream is detected, or an exception is thrown.
EOFException - if this stream reaches the end before reading
two bytes.IOException - if an I/O error occurs.public int readUnsignedShort()
throws IOException
readUnsignedShort in interface DataInputIOExceptionpublic final int readUnsignedShortLE()
throws IOException
b1 and b2, where
0 <= b1, b2 <= 255,
then the result is equal to:
(b2 << 8) | b1
This method blocks until the two bytes are read, the end of the stream is detected, or an exception is thrown.
EOFException - if this stream reaches the end before reading
two bytes.IOException - if an I/O error occurs.public char readChar()
throws IOException
readChar in interface DataInputIOExceptionpublic final char readCharLE()
throws IOException
b1 and b2, where
0 <= b1, b2 <= 255,
then the result is equal to:
(char)((b2 << 8) | b1)
This method blocks until the two bytes are read, the end of the stream is detected, or an exception is thrown.
EOFException - if this stream reaches the end before reading
two bytes.IOException - if an I/O error occurs.public int readInt()
throws IOException
readInt in interface DataInputIOExceptionpublic final int readIntLE()
throws IOException
b1,
b2, b3, and b4, where
0 <= b1, b2, b3, b4 <= 255,
then the result is equal to:
(b4 << 24) | (b3 << 16) + (b2 << 8) + b1
This method blocks until the four bytes are read, the end of the stream is detected, or an exception is thrown.
int.EOFException - if this stream reaches the end before reading
four bytes.IOException - if an I/O error occurs.public final long readUnsignedInt()
throws IOException
b1,
b2, b3, and b4, where
0 <= b1, b2, b3, b4 <= 255,
then the result is equal to:
(b1 << 24) | (b2 << 16) + (b3 << 8) + b4
This method blocks until the four bytes are read, the end of the stream is detected, or an exception is thrown.
long.EOFException - if this stream reaches the end before reading
four bytes.IOException - if an I/O error occurs.public final long readUnsignedIntLE()
throws IOException
IOExceptionpublic long readLong()
throws IOException
readLong in interface DataInputIOExceptionpublic final long readLongLE()
throws IOException
IOExceptionpublic float readFloat()
throws IOException
readFloat in interface DataInputIOExceptionpublic final float readFloatLE()
throws IOException
IOExceptionpublic double readDouble()
throws IOException
readDouble in interface DataInputIOExceptionpublic final double readDoubleLE()
throws IOException
IOExceptionpublic String readLine() throws IOException
readLine in interface DataInputIOExceptionpublic String readUTF() throws IOException
readUTF in interface DataInputIOExceptionpublic String readString(int length, String encoding) throws IOException
String from the font file as bytes using the given
encoding.length - the length of bytes to readencoding - the given encodingString readIOException - the font file could not be readCopyright © 2020. All rights reserved.