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
| Constructor and Description |
|---|
CmsFileBuffer() |
| Modifier and Type | Method and Description |
|---|---|
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 CmsFileBuffer()
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