类 MemoryByteArray
java.lang.Object
com.google.typography.font.sfntly.data.ByteArray<MemoryByteArray>
com.google.typography.font.sfntly.data.MemoryByteArray
A fixed size memory implementation of the ByteArray interface.
- 作者:
- Stuart Gill
-
字段概要
字段 -
构造器概要
构造器构造器说明MemoryByteArray
(byte[] b) Construct a new MemoryByteArray to wrap the actual underlying byte array.MemoryByteArray
(byte[] b, int filledLength) Construct a new MemoryByteArray to wrap the actual underlying byte array.MemoryByteArray
(int length) Construct a new MemoryByteArray with a new array of the size given. -
方法概要
修饰符和类型方法说明void
close()
Close this instance of the ByteArray.int
copyTo
(OutputStream os, int offset, int length) Copies this ByteArray to an OutputStream.protected int
internalGet
(int index) Gets the byte at the index given.protected int
internalGet
(int index, byte[] b, int offset, int length) Gets the bytes at the index given of the given length.protected void
internalPut
(int index, byte b) Stores the byte at the index given.protected int
internalPut
(int index, byte[] b, int offset, int length) Stores the array of bytes at the given index.
-
字段详细资料
-
b
private byte[] b
-
-
构造器详细资料
-
MemoryByteArray
public MemoryByteArray(int length) Construct a new MemoryByteArray with a new array of the size given. It is assumed that none of the array is filled and readable.- 参数:
length
- the length to make the storage array
-
MemoryByteArray
public MemoryByteArray(byte[] b) Construct a new MemoryByteArray to wrap the actual underlying byte array. This MemoryByteArray takes ownership of the array after construction and it should not be used outside of this object. It is assumed that the entire array is filled and readable.- 参数:
b
- the byte array that provides the actual storage
-
MemoryByteArray
public MemoryByteArray(byte[] b, int filledLength) Construct a new MemoryByteArray to wrap the actual underlying byte array. This MemoryByteArray takes ownership of the array after construction and it should not be used outside of this object.- 参数:
b
- the byte array that provides the actual storagefilledLength
- the index of the last byte in the array has data- 抛出:
IndexOutOfBoundsException
- if the given bounds don't fit within the byte array given
-
-
方法详细资料
-
internalPut
protected void internalPut(int index, byte b) 从类复制的说明:ByteArray
Stores the byte at the index given.- 指定者:
internalPut
在类中ByteArray<MemoryByteArray>
- 参数:
index
- the location to store atb
- the byte to store
-
internalPut
protected int internalPut(int index, byte[] b, int offset, int length) 从类复制的说明:ByteArray
Stores the array of bytes at the given index.- 指定者:
internalPut
在类中ByteArray<MemoryByteArray>
- 参数:
index
- the location to store atb
- the bytes to storeoffset
- the offset to start from in the byte arraylength
- the length of the byte array to store from the offset- 返回:
- the number of bytes actually stored
-
internalGet
protected int internalGet(int index) 从类复制的说明:ByteArray
Gets the byte at the index given.- 指定者:
internalGet
在类中ByteArray<MemoryByteArray>
- 参数:
index
- the location to get from- 返回:
- the byte stored at the index
-
internalGet
protected int internalGet(int index, byte[] b, int offset, int length) 从类复制的说明:ByteArray
Gets the bytes at the index given of the given length.- 指定者:
internalGet
在类中ByteArray<MemoryByteArray>
- 参数:
index
- the location to start getting fromb
- the array to put the bytes intooffset
- the offset in the array to put the bytes intolength
- the length of bytes to read- 返回:
- the number of bytes actually ready
-
close
public void close()从类复制的说明:ByteArray
Close this instance of the ByteArray.- 指定者:
close
在类中ByteArray<MemoryByteArray>
-
copyTo
从类复制的说明:ByteArray
Copies this ByteArray to an OutputStream.- 覆盖:
copyTo
在类中ByteArray<MemoryByteArray>
- 参数:
os
- the destinationoffset
-length
-- 返回:
- the number of bytes copied
- 抛出:
IOException
-