Interface IDataProvider


@Ser public interface IDataProvider
Provider of named binary entries, optionally qualified by an integer identifier.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Return value used by optional methods that are not implemented.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    getDataBytes(String key, int id)
     
    default int
    getDataBytes(String name, int id, byte[] buffer, int bufferOffset, int wantedSize)
    Optional method allowing callers to retrieve a subset of an entry without materializing it entirely.
    long
    getDataSize(String key, int id)
     
    default InputStream
    openDataStream(String name, int id)
    Optional method.
  • Field Details

    • NOT_IMPLEMENTED

      static final int NOT_IMPLEMENTED
      Return value used by optional methods that are not implemented.
      See Also:
  • Method Details

    • getDataSize

      long getDataSize(String key, int id)
      Parameters:
      key - entry name
      id - optional entry id
      Returns:
      the size of the entry (may be more than 4Gb), or a negative value if unavailable
    • getDataBytes

      byte[] getDataBytes(String key, int id)
      Parameters:
      key - entry name
      id - optional entry id
      Returns:
      the entire entry data, or null if unavailable; implementations are expected to return at most 2Gb
    • getDataBytes

      default int getDataBytes(String name, int id, byte[] buffer, int bufferOffset, int wantedSize)
      Optional method allowing callers to retrieve a subset of an entry without materializing it entirely. The default implementation returns NOT_IMPLEMENTED.
      Parameters:
      name - entry name
      id - optional entry id
      buffer - destination buffer
      bufferOffset - offset where the data should be written to in the buffer
      wantedSize - requested size to read
      Returns:
      the actual read size (may be less than requested); a negative number on error
    • openDataStream

      default InputStream openDataStream(String name, int id) throws IOException
      Optional method. The default implementation returns null.
      Parameters:
      name - entry name
      id - optional entry id
      Returns:
      an input stream for the entry, or null if this access mode is unsupported; the caller must close the stream
      Throws:
      IOException - on I/O error