Package org.jppf.io
Class MultipleBuffersLocation
java.lang.Object
org.jppf.io.AbstractDataLocation
org.jppf.io.MultipleBuffersLocation
- All Implemented Interfaces:
DataLocation
Data location backed by a list of
JPPFBuffer.- Author:
- Laurent Cohen
-
Field Summary
Fields inherited from class org.jppf.io.AbstractDataLocation
size, transferringFields inherited from interface org.jppf.io.DataLocation
UNKNOWN_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionMultipleBuffersLocation(byte[]... buffers) Initialize this location from an array of buffers.MultipleBuffersLocation(int size) Initialize this location with the specified size.MultipleBuffersLocation(int size, JPPFBuffer... buffers) Initialize this location from an array of buffers.MultipleBuffersLocation(List<JPPFBuffer> buffers) Initialize this location with the specified list of buffers.MultipleBuffersLocation(List<JPPFBuffer> list, int size) Initialize this location with the specified list of buffers and size.MultipleBuffersLocation(JPPFBuffer... buffers) Initialize this location from an array of buffers. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Make a shallow copy of this data location.getBuffer(int n) Get the buffer at the specified index..Get an input stream for this location.Get an output stream for this location.reset()Reset the state of this location.toString()inttransferFrom(InputSource source, boolean blocking) Transfer the content of this data location from the specified input source.inttransferTo(OutputDestination dest, boolean blocking) Transfer the content of this data location to the specified output destination.Methods inherited from class org.jppf.io.AbstractDataLocation
getSize, setSize
-
Constructor Details
-
MultipleBuffersLocation
public MultipleBuffersLocation(int size) Initialize this location with the specified size.- Parameters:
size- the total size of the data.
-
MultipleBuffersLocation
Initialize this location with the specified list of buffers and size.- Parameters:
list- the list of buffers that contain the data.size- the total size of the data.
-
MultipleBuffersLocation
Initialize this location with the specified list of buffers. The size is computed as the sum of used sizes of all buffers.- Parameters:
buffers- the list of buffers that contain the data.
-
MultipleBuffersLocation
Initialize this location from an array of buffers.- Parameters:
buffers- the buffers that contain the data.
-
MultipleBuffersLocation
Initialize this location from an array of buffers.- Parameters:
size- the data total size.buffers- the buffers that contain the data.
-
MultipleBuffersLocation
public MultipleBuffersLocation(byte[]... buffers) Initialize this location from an array of buffers.- Parameters:
buffers- the buffers that contain the data.
-
-
Method Details
-
transferFrom
Description copied from interface:DataLocationTransfer the content of this data location from the specified input source.- Parameters:
source- - the input source to transfer to.blocking- - if true, the method will block until the entire content has been transferred.- Returns:
- the number of bytes actually transferred.
- Throws:
Exception- if an IO error occurs.
-
transferTo
Description copied from interface:DataLocationTransfer the content of this data location to the specified output destination.- Parameters:
dest- - the output destination to transfer to.blocking- - if true, the method will block until the entire content has been transferred.- Returns:
- the number of bytes actually transferred.
- Throws:
Exception- if an IO error occurs.
-
getInputStream
Description copied from interface:DataLocationGet an input stream for this location.- Returns:
- an
InputStreaminstance. - Throws:
Exception- if an I/O error occurs.
-
getOutputStream
Description copied from interface:DataLocationGet an output stream for this location.- Returns:
- an
OutputStreaminstance. - Throws:
Exception- if an I/O error occurs.
-
copy
Description copied from interface:DataLocationMake a shallow copy of this data location. The data it points to is not copied.- Returns:
- a new DataLocation instance pointing to the same data.
-
getBuffer
Get the buffer at the specified index..- Parameters:
n- the index of the buffer to get.- Returns:
- a list of
JPPFBufferinstances.
-
reset
Reset the state of this location.- Returns:
- this location, for method call chaining.
-
toString
-