public class InMemoryRandomAccessContent extends Object implements RandomAccessContentInterface
Constructor and Description |
---|
InMemoryRandomAccessContent(byte[] bytes,
boolean mustCopy)
Creates a InMemoryRandomAccessContent from an array of bytes.
|
InMemoryRandomAccessContent(InputStream is)
Creates an InMemoryRandomAccessContent from an InputStream.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canWrite()
Always returns false
|
void |
close()
Release used memory
|
void |
dispose()
Releases used memory
|
void |
flush()
Throws IfsException 32236
|
long |
getLength()
returns the length of this content object.
|
int |
read(long fOffset,
byte[] buf,
int bOffset,
int length)
read length bytes from file offset, filling buffer starting at boffset.
|
void |
truncate(long offset)
Throws IfsException 32236
|
void |
write(long fOffset,
byte[] buf,
int bOffset,
int length)
Throws IfsException 32236
|
public InMemoryRandomAccessContent(byte[] bytes, boolean mustCopy)
bytes
- The bytes which compose the content of the objectmustCopy
- If true, then the byte array passed in must be copied.
Otherwise, the passed-in bytes array is used directly.public InMemoryRandomAccessContent(InputStream is) throws IOException
is
- The stream to use as input.IOException
- thrown if an error occured reading the streampublic int read(long fOffset, byte[] buf, int bOffset, int length)
read
in interface RandomAccessContentInterface
fOffset
- offset at which to begin reading.buf
- the byte array into which data is to be readbOffset
- the offset into the bufferlength
- the amount of data to read.public void write(long fOffset, byte[] buf, int bOffset, int length) throws IfsException
write
in interface RandomAccessContentInterface
fOffset
- offset at which to begin writing.buf
- the byte array containing the data to be writtenbOffset
- the offset into the buffer to begin writing fromlength
- the amount of data to writeIfsException
- if operation failspublic void truncate(long offset) throws IfsException
truncate
in interface RandomAccessContentInterface
offset
- offset at which to truncate.IfsException
- if operation failspublic void flush() throws IfsException
flush
in interface RandomAccessContentInterface
IfsException
- if operation failspublic void close() throws IfsException
close
in interface RandomAccessContentInterface
IfsException
- if operation failspublic void dispose() throws IfsException
dispose
in interface RandomAccessContentInterface
IfsException
- if operation failspublic boolean canWrite()
canWrite
in interface RandomAccessContentInterface
public long getLength()
getLength
in interface RandomAccessContentInterface
Copyright © 2023. All rights reserved.