Interface Blob


public interface Blob
Reference to a blob, which is simply a piece of data identified by its container and name.
  • Method Details

    • getName

      String getName()
      Gets the name of this blob.
      Returns:
      the blo name
    • getContainer

      Container getContainer()
      Gets the container for this blob.
      Returns:
      the container
    • exists

      boolean exists() throws IOException
      Returns true if the blob exists; false otherwise.
      Returns:
      true if the blob exists; false otherwise
      Throws:
      IOException - if an I/O error occurred
    • delete

      boolean delete() throws IOException
      Deletes this blob if it exists.
      Returns:
      true if the blob was deleted; false if the blob does not exist
      Throws:
      IOException - if an I/O error occurred
    • lastModified

      Instant lastModified() throws IOException
      Returns the last modified time of the blob.
      Returns:
      the last modified time
      Throws:
      IOException - if an I/O error occurred
    • openReader

      Reader openReader() throws IOException
      Creates and returns a Reader for reading text from this blob. The caller is responsible for closing the reader when finished.
      Returns:
      a reader for this blob
      Throws:
      IOException - if an I/O error occurred
    • openInputStream

      InputStream openInputStream() throws IOException
      Creates and returns an InputStream for reading binary data from this blob. The caller is responsible for closing the stream when finished.
      Returns:
      an input stream for this blob
      Throws:
      IOException - if an I/O error occurred
    • openWriter

      TransactionalWriter openWriter() throws IOException
      Creates and returns a TransactionalWriter for writing text to this blob. The caller is responsible for committing and closing the writer when finished. If the writer is closed before being committed, any written content is discarded.
      Returns:
      the writer for this blob
      Throws:
      IOException - if an I/O error occurred
    • openOutputStream

      TransactionalOutputStream openOutputStream() throws IOException
      Creates and returns a TransactionalOutputStream for writing binary data to this blob. The caller is responsible for committing and closing the stream when finished. If the stream is closed before being committed, any written content is discarded.
      Returns:
      the output stream for this blob
      Throws:
      IOException - if an I/O error occurred
    • ifMissing

      default boolean ifMissing(IOCallback<Blob> callback) throws IOException
      Executes the callback function if this blob is missing.
      Parameters:
      callback - the callback function
      Returns:
      true if the blob is missing and the callback was invoked; false otherwise
      Throws:
      IOException - if an I/O error occurred
    • ifFound

      default boolean ifFound(IOCallback<Blob> callback) throws IOException
      Executes the callback function if this blob exists.
      Parameters:
      callback - the callback function
      Returns:
      true if the blob exists and the callback was invoked; false otherwise
      Throws:
      IOException - if an I/O error occurred
    • extract

      default void extract(File file) throws IOException
      Extracts the content of this blob to a file.
      Parameters:
      file - the destination file
      Throws:
      IOException - if an I/O error occurred
    • extract

      default void extract(Path path) throws IOException
      Extracts the content of this blob to a path.
      Parameters:
      path - the destination path
      Throws:
      IOException - if an I/O error occurred
    • extract

      default void extract(OutputStream out) throws IOException
      Transfers the content of this blob to an output stream.
      Parameters:
      out - the output stream
      Throws:
      IOException - if an I/O error occurred
    • extract

      default void extract(Writer out) throws IOException
      Transfers the content of this blob to a writer.
      Parameters:
      out - the writer
      Throws:
      IOException - if an I/O error occurred
    • extract

      default void extract(InputStreamCallback callback) throws IOException
      Executes a callback with an InputStream for reading this blob. The input stream is automatically closed when the callback returns.
      Parameters:
      callback - the callback function
      Throws:
      IOException - if an I/O error occurred
    • extract

      default void extract(ReaderCallback callback) throws IOException
      Executes a callback with a Reader for reading this blob. The reader is automatically closed when the callback returns.
      Parameters:
      callback - the callback function
      Throws:
      IOException - if an I/O error occurred
    • extractIfFound

      default boolean extractIfFound(InputStreamCallback callback) throws IOException
      Executes the callback with an InputStream for reading this blob, but only if the blob exists. The stream is automatically closed when the callback returns.
      Parameters:
      callback - the callback function
      Returns:
      true if the blob exists and the callback was invoked; false otherwise
      Throws:
      IOException - if an I/O error occurred
    • extractIfFound

      default boolean extractIfFound(ReaderCallback callback) throws IOException
      Executes the callback with a Reader for reading this blob, but only if the blob exists. The reader is automatically closed when the callback returns.
      Parameters:
      callback - the callback function
      Returns:
      true if the blob exists and the callback was invoked; false otherwise
      Throws:
      IOException - if an I/O error occurred
    • extractObject

      default Object extractObject() throws IOException, ClassNotFoundException
      Extracts the blob and deserializes the content.
      Returns:
      the deserialized object
      Throws:
      IOException - if an I/O error occurred
      ClassNotFoundException - if the class of the serialized object could not be found
    • extractObject

      default <T> T extractObject(Class<T> type) throws IOException, ClassNotFoundException
      Extracts the blob and deserializes the content.
      Type Parameters:
      T - the return type
      Parameters:
      type - the type of the object
      Returns:
      the deserialized object cast to the given type
      Throws:
      IOException - if an I/O error occurred
      ClassNotFoundException - if the class of the serialized object could not be found
    • store

      default void store(File file) throws IOException
      Stores the contents of a file to this blob.
      Parameters:
      file - the source file
      Throws:
      IOException - if an I/O error occurred
    • store

      default void store(Path path) throws IOException
      Stores the contents of a path to this blob.
      Parameters:
      path - the source path
      Throws:
      IOException - if an I/O error occurred
    • store

      default void store(Population population) throws IOException
      Stores the given Population object to this blob as a result file.
      Parameters:
      population - the population to store
      Throws:
      IOException - if an I/O error occurred
    • store

      default void store(Formattable<?> formattable) throws IOException
      Stores the given Formattable object to this blob using the TableFormat.Plaintext format.
      Parameters:
      formattable - the formattable object to store
      Throws:
      IOException - if an I/O error occurred
    • store

      default void store(Formattable<?> formattable, TableFormat tableFormat) throws IOException
      Stores the given Formattable object to this blob using the specified table format.
      Parameters:
      formattable - the formattable object to store
      tableFormat - the table format
      Throws:
      IOException - if an I/O error occurred
    • store

      default void store(InputStream in) throws IOException
      Stores the content read from an input stream to this this blob.
      Parameters:
      in - the input stream
      Throws:
      IOException - if an I/O error occurred
    • store

      default void store(Reader reader) throws IOException
      Stores the content read from a reader to this this blob.
      Parameters:
      reader - the reader
      Throws:
      IOException - if an I/O error occurred
    • store

      default void store(OutputStreamCallback callback) throws IOException
      Executes a callback with an OutputStream for writing to this blob. The output stream is automatically closed when the callback returns.
      Parameters:
      callback - the callback function
      Throws:
      IOException - if an I/O error occurred
    • store

      default void store(PrintStreamCallback callback) throws IOException
      Executes a callback with a PrintStream for writing to this blob. The output stream is automatically closed when the callback returns.
      Parameters:
      callback - the callback function
      Throws:
      IOException - if an I/O error occurred
    • store

      default void store(WriterCallback callback) throws IOException
      Executes a callback with a Writer for writing to this blob. The output stream is automatically closed when the callback returns.
      Parameters:
      callback - the callback function
      Throws:
      IOException - if an I/O error occurred
    • storeIfMissing

      default boolean storeIfMissing(OutputStreamCallback callback) throws IOException
      Executes the callback with an OutputStream for writing to this blob, but only if the blob does not already exist. The stream is automatically closed when the callback returns.
      Parameters:
      callback - the callback function
      Returns:
      true if the blob did not exist and the callback was invoked; false otherwise
      Throws:
      IOException - if an I/O error occurred
    • storeIfMissing

      default boolean storeIfMissing(PrintStreamCallback callback) throws IOException
      Executes the callback with a PrintStream for writing to this blob, but only if the blob does not already exist. The stream is automatically closed when the callback returns.
      Parameters:
      callback - the callback function
      Returns:
      true if the blob did not exist and the callback was invoked; false otherwise
      Throws:
      IOException - if an I/O error occurred
    • storeIfMissing

      default boolean storeIfMissing(WriterCallback callback) throws IOException
      Executes the callback with a Writer for writing to this blob, but only if the blob does not already exist. The stream is automatically closed when the callback returns.
      Parameters:
      callback - the callback function
      Returns:
      true if the blob did not exist and the callback was invoked; false otherwise
      Throws:
      IOException - if an I/O error occurred
    • storeObject

      default void storeObject(Object value) throws IOException, NotSerializableException
      Stores a serializable object to the blob.
      Parameters:
      value - the object to store
      Throws:
      IOException - if an I/O error occurred
      NotSerializableException - if the object is not serializable