Package org.jppf.io
Interface DataLocation
- All Known Implementing Classes:
AbstractDataLocation,FileDataLocation,MultipleBuffersLocation
public interface DataLocation
This interface represents an abstraction of a block of data, regardless of where it is stored.
- Author:
- Laurent Cohen
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConstant for unknown data location size. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Make a shallow copy of this data location.Get an input stream for this location.Get an output stream for this location.intgetSize()Get the size of the data referenced by this data location.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.
-
Field Details
-
UNKNOWN_SIZE
static final int UNKNOWN_SIZEConstant for unknown data location size.- See Also:
-
-
Method Details
-
getSize
int getSize()Get the size of the data referenced by this data location.- Returns:
- the data size as an int.
-
transferFrom
Transfer 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
Transfer 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
Get an input stream for this location.- Returns:
- an
InputStreaminstance. - Throws:
Exception- if an I/O error occurs.
-
getOutputStream
Get an output stream for this location.- Returns:
- an
OutputStreaminstance. - Throws:
Exception- if an I/O error occurs.
-
copy
DataLocation copy()Make 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.
-