public class MemoryLocation extends AbstractLocation<byte[]>
Location interface allows writing to and reading from a byte array.eventsEnabled, listeners, path| Constructor and Description |
|---|
MemoryLocation(byte[] buffer)
Initialize this location with the specified buffer.
|
MemoryLocation(byte[] buffer,
int offset,
int len)
Initialize this location with the specified byte array.
|
MemoryLocation(int size)
Initialize this location and create a buffer of the specified size.
|
| Modifier and Type | Method and Description |
|---|---|
InputStream |
getInputStream()
Obtain an input stream to read from this location.
|
OutputStream |
getOutputStream()
Obtain an output stream to write to this location.
|
long |
size()
Get the size of the file this location points to.
|
byte[] |
toByteArray()
Get the content at this location as an array of bytes.
|
addLocationEventListener, copyTo, fireLocationEvent, getPath, removeLocationEventListener, toStringpublic MemoryLocation(int size)
size - the size of the buffer handled by this memory location.public MemoryLocation(byte[] buffer)
buffer - an array of bytes.public MemoryLocation(byte[] buffer,
int offset,
int len)
buffer - an array of bytes.offset - the start position in the array of bytes.len - the length of the buffer.public InputStream getInputStream() throws Exception
InputStream instance.Exception - if an I/O error occurs.Location.getInputStream()public OutputStream getOutputStream() throws Exception
OutputStream instance.Exception - if an I/O error occurs.Location.getOutputStream()public long size()
Location.size()public byte[] toByteArray()
throws Exception
AbstractLocation.toByteArray() for improved performance.toByteArray in interface Location<byte[]>toByteArray in class AbstractLocation<byte[]>Exception - if an I/O error occurs.AbstractLocation.toByteArray()Copyright © 2005-2012 JPPF Team.