Module methanol

Interface Store.Viewer

All Superinterfaces:
AutoCloseable, Closeable
Enclosing interface:
Store

public static interface Store.Viewer extends Closeable
Reads an entry's metadata block and data stream.
  • Method Details

    • key

      String key()
      Returns the entry's key.
    • metadata

      ByteBuffer metadata()
      Returns the entry's metadata as a readonly buffer.
    • newReader

      Store.EntryReader newReader()
      Returns a new Store.EntryReader that reads the entry's data stream from the start. A viewer can have multiple concurrent readers, each with an independent position.
    • dataSize

      long dataSize()
      Returns the size in bytes of the data stream.
    • entrySize

      long entrySize()
      Returns the size in bytes of the metadata block and data stream.
    • edit

      default Optional<Store.Editor> edit() throws IOException
      Synchronous variant of edit(Executor).
      Throws:
      IllegalStateException - if closed
      IOException
    • edit

      Opens an editor for the entry this viewer was opened for. An empty optional is returned if another edit is in progress or if the entry has been modified since this viewer was created. Changes made by the returned editor are not reflected by this viewer.
      Throws:
      IllegalStateException - if closed
    • removeEntry

      boolean removeEntry() throws IOException
      Removes the entry associated with this viewer only if it hasn't changed since this viewer was opened.
      Throws:
      IllegalStateException - if closed
      IOException
    • close

      void close()
      Closes this viewer.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable