Class ArraySlice
java.lang.Object
nonapi.io.github.classgraph.fileslice.Slice
nonapi.io.github.classgraph.fileslice.ArraySlice
- All Implemented Interfaces:
Closeable
,AutoCloseable
A byte array slice.
-
Field Summary
FieldsFields inherited from class nonapi.io.github.classgraph.fileslice.Slice
inflatedLengthHint, isDeflatedZipEntry, nestedJarHandler, parentSlice, sliceLength, sliceStartPos
-
Constructor Summary
ConstructorsModifierConstructorDescriptionArraySlice
(byte[] arr, boolean isDeflatedZipEntry, long inflatedLengthHint, NestedJarHandler nestedJarHandler) Constructor for treating a whole array as a slice.private
ArraySlice
(ArraySlice parentSlice, long offset, long length, boolean isDeflatedZipEntry, long inflatedLengthHint, NestedJarHandler nestedJarHandler) Constructor for treating a range of an array as a slice. -
Method Summary
-
Field Details
-
arr
public byte[] arrThe wrapped byte array.
-
-
Constructor Details
-
ArraySlice
private ArraySlice(ArraySlice parentSlice, long offset, long length, boolean isDeflatedZipEntry, long inflatedLengthHint, NestedJarHandler nestedJarHandler) Constructor for treating a range of an array as a slice.- Parameters:
parentSlice
- the parent sliceoffset
- the offset of the sub-slice within the parent slicelength
- the length of the sub-sliceisDeflatedZipEntry
- true if this is a deflated zip entryinflatedLengthHint
- the uncompressed size of a deflated zip entry, or -1 if unknown, or 0 of this is not a deflated zip entry.nestedJarHandler
- the nested jar handler
-
ArraySlice
public ArraySlice(byte[] arr, boolean isDeflatedZipEntry, long inflatedLengthHint, NestedJarHandler nestedJarHandler) Constructor for treating a whole array as a slice.- Parameters:
arr
- the array containing the slice.isDeflatedZipEntry
- true if this is a deflated zip entryinflatedLengthHint
- the uncompressed size of a deflated zip entry, or -1 if unknown, or 0 of this is not a deflated zip entry.nestedJarHandler
- the nested jar handler
-
-
Method Details
-
slice
Slice this slice to form a sub-slice.- Specified by:
slice
in classSlice
- Parameters:
offset
- the offset relative to the start of this slice to use as the start of the sub-slice.length
- the length of the sub-slice.isDeflatedZipEntry
- the is deflated zip entryinflatedLengthHint
- the uncompressed size of a deflated zip entry, or -1 if unknown, or 0 of this is not a deflated zip entry.- Returns:
- the slice
-
load
Load the slice as a byte array.- Specified by:
load
in classSlice
- Returns:
- the byte[]
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
randomAccessReader
Return a new random access reader.- Specified by:
randomAccessReader
in classSlice
- Returns:
- the random access reader
-
equals
-
hashCode
public int hashCode()
-