Class FsFzipEntryRegistry
- All Implemented Interfaces:
IFzipEntryRegistry
- Direct Known Subclasses:
SnapshotEntryRegistry
Entries of this registry inherit AbstractNamedFzipEntry
.
Entry descriptors of this registry begin with a byte denoting the entry type. The value of this byte
is between 0 (inclusively) and LAST_RESERVED_ETYPE
(inclusively). Subclasses must use type bytes
out of this range to denote their entries.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The maximal reserved type byte value.Fields inherited from interface com.e1c.g5.v8.fastzip.entry.IFzipEntryRegistry
MAX_ENTRY_DESCRIPTOR_LENGTH
-
Constructor Summary
ConstructorsConstructorDescriptionFsFzipEntryRegistry
(Path root) Constructs a new filesystem FastZIP entry registry with the default partitioning limit and memory mapped IO enabled.FsFzipEntryRegistry
(Path root, boolean enableMmap) Constructs a new filesystem FastZIP entry registry with the default partitioning limit.FsFzipEntryRegistry
(Path root, long partitioningSizeLimit) Constructs a new filesystem FastZIP entry registry with memory mapped IO enabled.FsFzipEntryRegistry
(Path root, long partitioningSizeLimit, boolean enableMmap) Constructs a new filesystem FastZIP entry registry. -
Method Summary
Modifier and TypeMethodDescriptioncreateEntryDescriptor
(Path path) Creates entries for a path.getPaths
(Stream<IFzipEntry> entries) Get paths from a stream of entries.getRoot()
Gets the registry root.readEntryDescriptor
(Supplier<DataInput> inputSupplier) Deserializes entry fromDataInput
.void
writeEntryDescriptor
(IFzipEntry entry, DataOutput out) Serializes an entry toDataOutput
.
-
Field Details
-
LAST_RESERVED_ETYPE
public static final int LAST_RESERVED_ETYPEThe maximal reserved type byte value. Entry descriptors of this registry begin with a byte between 0 (inclusively) and 8 (inclusively).- See Also:
-
-
Constructor Details
-
FsFzipEntryRegistry
Constructs a new filesystem FastZIP entry registry with memory mapped IO enabled.- Parameters:
root
- the registry root, cannot benull
partitioningSizeLimit
- partitioning limit in bytes, larger files will be partitioned to support parallel compression, must be positive- Throws:
IllegalArgumentException
- if argument constraints are not satisfied
-
FsFzipEntryRegistry
Constructs a new filesystem FastZIP entry registry with the default partitioning limit.- Parameters:
root
- the registry root, cannot benull
enableMmap
- whether memory mapped IO shall be used to write and read partitioned files- Throws:
IllegalArgumentException
- ifroot
isnull
-
FsFzipEntryRegistry
Constructs a new filesystem FastZIP entry registry with the default partitioning limit and memory mapped IO enabled.- Parameters:
root
- the registry root, cannot benull
- Throws:
IllegalArgumentException
- ifroot
isnull
-
FsFzipEntryRegistry
Constructs a new filesystem FastZIP entry registry.- Parameters:
root
- the registry root, cannot benull
partitioningSizeLimit
- partitioning limit in bytes, larger files will be partitioned to support parallel compression, must be positiveenableMmap
- whether memory mapped IO shall be used to write and read partitioned files- Throws:
IllegalArgumentException
- if argument constraints are not satisfied
-
-
Method Details
-
createEntryDescriptor
Creates entries for a path. The path must be a subpath of the registry root and refer to an existing file or directory.The returned stream contains at least one entry. If the file size exceeds the partitioning limit, a few entries are returned.
- Parameters:
path
- the path, cannot benull
- Returns:
- the stream of FastZIP entries, never
null
- Throws:
IOException
- if an IO error occursIllegalArgumentException
- if the given path is not subpath of the registry root
-
getPaths
Get paths from a stream of entries. Ignores non-filesystem entries.- Parameters:
entries
- the stream of entries, nevernull
- Returns:
- the stream of paths, never
null
-
getRoot
Gets the registry root.- Returns:
- the root, never
null
-
writeEntryDescriptor
Description copied from interface:IFzipEntryRegistry
Serializes an entry toDataOutput
.The behaviour is unspecified if more than
IFzipEntryRegistry.MAX_ENTRY_DESCRIPTOR_LENGTH
bytes were written to the output.- Specified by:
writeEntryDescriptor
in interfaceIFzipEntryRegistry
- Parameters:
entry
- the entry, nevernull
out
- the output, nevernull
- Throws:
IOException
- if an IO error occurs
-
readEntryDescriptor
Description copied from interface:IFzipEntryRegistry
Deserializes entry fromDataInput
.The input is provided by a supplier. The supplier may be invoked multiple times. Each invocation will yield an input with the same data.
The number of bytes read from the last supplied input must be equal to the number of bytes written on serialization. Otherwise the behaviour is unspecified.
The behaviour is unspecified if more than
IFzipEntryRegistry.MAX_ENTRY_DESCRIPTOR_LENGTH
bytes were read from the input.- Specified by:
readEntryDescriptor
in interfaceIFzipEntryRegistry
- Parameters:
inputSupplier
- the input supplier, nevernull
- Returns:
- the deserialized entry, cannot be
null
- Throws:
IOException
- if an IO error occurs or the entry cannot be deserialized
-