- All Superinterfaces:
AutoCloseable
,Closeable
- Enclosing interface:
Store
Reads an entry's metadata block and data stream.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes this viewer.long
dataSize()
Returns the size in bytes of the data stream.default Optional
<Store.Editor> edit()
Synchronous variant ofedit(Executor)
.Opens an editor for the entry this viewer was opened for.long
Returns the size in bytes of the metadata block and data stream.key()
Returns the entry's key.metadata()
Returns the entry's metadata as a readonly buffer.Returns a newStore.EntryReader
that reads the entry's data stream from the start.boolean
Removes the entry associated with this viewer only if it hasn't changed since this viewer was opened.
-
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 newStore.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
Synchronous variant ofedit(Executor)
.- Throws:
IllegalStateException
- if closedIOException
-
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
Removes the entry associated with this viewer only if it hasn't changed since this viewer was opened.- Throws:
IllegalStateException
- if closedIOException
-
close
void close()Closes this viewer.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-