public class CmsFileBuffer
extends java.lang.Object
This is implemented as a CmsByteBuffer instance together with a 'position' index which marks the next write position
| 构造器和说明 |
|---|
CmsFileBuffer() |
| 限定符和类型 | 方法和说明 |
|---|---|
byte[] |
getContents()
Gets the contents of this buffer as a byte array.
|
long |
getLength()
Gets the length of the file content.
|
long |
getPosition()
Gets the current write position.
|
void |
init(byte[] data)
Initializes the file content data.
|
int |
read(byte[] dest,
int length,
int bufferOffset,
int fileOffset)
Transfers data from this buffer to a byte array.
|
void |
seek(long newPos)
Changes the write position.
|
void |
truncate(int size)
Changes the size of this buffer.
|
void |
write(byte[] data)
Writes the data to the internal buffer.
|
public byte[] getContents()
public long getLength()
public long getPosition()
public void init(byte[] data)
data - the file content datapublic int read(byte[] dest,
int length,
int bufferOffset,
int fileOffset)
dest - the target byte arraylength - the number of bytes to transferbufferOffset - the start index for the target bufferfileOffset - the start index for this instancepublic void seek(long newPos)
newPos - the new write positionpublic void truncate(int size)
size - the new sizepublic void write(byte[] data)
data - the data to write