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)
instead
filename
-
IOException
@Deprecated public RandomAccessFileOrArray(RandomAccessFileOrArray source)
createView()
instead
source
- the source for the new independent view
public 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)
instead
filename
- 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 memory
plainRandomAccess
- 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 used
IOException
- if there is a failure opening or reading the file
@Deprecated public RandomAccessFileOrArray(URL url) throws IOException
RandomAccessSourceFactory.createSource(URL)
and RandomAccessFileOrArray(RandomAccessSource)
instead
url
-
IOException
@Deprecated public RandomAccessFileOrArray(InputStream is) throws IOException
RandomAccessSourceFactory.createSource(InputStream)
and RandomAccessFileOrArray(RandomAccessSource)
instead
is
-
IOException
@Deprecated public RandomAccessFileOrArray(byte[] arrayIn)
RandomAccessSourceFactory.createSource(byte[])
and RandomAccessFileOrArray(RandomAccessSource)
instead
arrayIn
- byte[]
IOException
public RandomAccessFileOrArray createView()
public RandomAccessSource createSourceView()
@Deprecated protected RandomAccessSource getByteSource()
public void pushBack(byte b)
b
- the byte to push
public int read() throws IOException
IOException
public int read(byte[] b, int off, int len) throws IOException
IOException
public int read(byte[] b) throws IOException
IOException
public void readFully(byte[] b) throws IOException
readFully
in interface DataInput
IOException
public void readFully(byte[] b, int off, int len) throws IOException
readFully
in interface DataInput
IOException
public long skip(long n) throws IOException
IOException
public int skipBytes(int n) throws IOException
skipBytes
in interface DataInput
IOException
@Deprecated public void reOpen() throws IOException
IOException
public void close() throws IOException
IOException
public long length() throws IOException
IOException
public void seek(long pos) throws IOException
IOException
public long getFilePointer() throws IOException
IOException
public boolean readBoolean() throws IOException
readBoolean
in interface DataInput
IOException
public byte readByte() throws IOException
readByte
in interface DataInput
IOException
public int readUnsignedByte() throws IOException
readUnsignedByte
in interface DataInput
IOException
public short readShort() throws IOException
readShort
in interface DataInput
IOException
public 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 DataInput
IOException
public 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 DataInput
IOException
public 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 DataInput
IOException
public 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
IOException
public long readLong() throws IOException
readLong
in interface DataInput
IOException
public final long readLongLE() throws IOException
IOException
public float readFloat() throws IOException
readFloat
in interface DataInput
IOException
public final float readFloatLE() throws IOException
IOException
public double readDouble() throws IOException
readDouble
in interface DataInput
IOException
public final double readDoubleLE() throws IOException
IOException
public String readLine() throws IOException
readLine
in interface DataInput
IOException
public String readUTF() throws IOException
readUTF
in interface DataInput
IOException
public 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 read
encoding
- the given encoding
String
read
IOException
- the font file could not be read
Copyright © 1998–2018. All rights reserved.