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

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Constant for unknown data location size.
  • Method Summary

    Modifier and Type
    Method
    Description
    Make a shallow copy of this data location.
    Get an input stream for this location.
    Get an output stream for this location.
    int
    Get the size of the data referenced by this data location.
    int
    transferFrom(InputSource source, boolean blocking)
    Transfer the content of this data location from the specified input source.
    int
    transferTo(OutputDestination dest, boolean blocking)
    Transfer the content of this data location to the specified output destination.
  • Field Details

    • UNKNOWN_SIZE

      static final int UNKNOWN_SIZE
      Constant 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

      int transferFrom(InputSource source, boolean blocking) throws Exception
      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

      int transferTo(OutputDestination dest, boolean blocking) throws Exception
      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

      InputStream getInputStream() throws Exception
      Get an input stream for this location.
      Returns:
      an InputStream instance.
      Throws:
      Exception - if an I/O error occurs.
    • getOutputStream

      OutputStream getOutputStream() throws Exception
      Get an output stream for this location.
      Returns:
      an OutputStream instance.
      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.