saker.nest Documentation TaskDoc JavaDoc Packages
public interface NestRepositoryBundle
Interface providing access to the contents of a Nest repository bundle.

A bundle is considered to be a simple immutable container of data by the perspective of the Nest repository. This interface provides functions that can be used to access the contents of it.

The contents may be interpreted in any way suitable for the caller.

This interface is not related to any current storage configurations, it only serves as a handle to the contents of a bundle. Bundles may be shared internally by different storage configurations.

This interface is not to be implemented by clients.

Methods
public default BundleIdentifier
Gets the identifier of the bundle.
public Path
Gets the path to the bundle-private storage directory.
public default ByteArrayRegion
Gets the full byte array contents of the given entry.
public NavigableSet<String>
Gets the names of entries in this bundle.
public byte[]
Gets a hash of the contents of the bundle.
public BundleInformation
Gets the bundle information associated with this bundle.
public BundleStorage
Gets the bundle storage that this bundle is contained in.
public default boolean
Checks if a given entry with the specified name is present in the bundle.
public InputStream
Opens a byte input stream to the contents of the entry with the given name.
Gets the identifier of the bundle.

The returned identifier can have arbitrary contents specified by the BundleIdentifier class. It may or may not contain any version qualifiers.

The identifier. Always non-null.
public abstract Path getBundleStoragePath()
Gets the path to the bundle-private storage directory.

Each bundle is provided with a private storage that they can use to store arbitrary data. It can be mainly used for caching purposes. The storage directory can be cleared at any moment, and clients shouldn't store crucial data in it.

One example use-case for it is to extract bundle entries to this directory which is later then passed to external processes as an input.

The absolute path to the storage directory.
Gets the full byte array contents of the given entry.
nameThe name of the entry.
The byte contents.
NullPointerExceptionIf the argument name is null.
IOExceptionIf the entry was not found, or an I/O error occurrs.
public abstract NavigableSet<String> getEntryNames()
Gets the names of entries in this bundle.

Directory entries are not included.

The hasEntry(String) method will return true for any entry name contained in the returned set.

An immutable set of entry names.
public abstract byte[] getHash()
Gets a hash of the contents of the bundle.

The hash is produced by hashing the raw byte contents of the bundle itself. If the bundle was compressed, the contents are not uncompressed for hashing. In case of JAR bundles, the bytes of the JAR is used to produce the hash.

Hashes of dependencies are not included.

The hash algorithm is implementation dependent.

The hash. Modifications don't propagate, the array is cloned.
Gets the bundle information associated with this bundle.
The bundle information. (Never null.)
public abstract BundleStorage getStorage()
Gets the bundle storage that this bundle is contained in.
The bundle storage.
public default boolean hasEntry(String name)
Checks if a given entry with the specified name is present in the bundle.

If the argument is null, this method returns false.

nameThe name.
true if the entry is present.
Opens a byte input stream to the contents of the entry with the given name.

The returned stream must be closed by the caller.

nameThe name of the entry.
The input stream to the contents of the entry.
NullPointerExceptionIf the argument name is null.
IOExceptionIf the entry was not found, or an I/O error occurrs.