public class PathSlice extends Slice implements java.io.Closeable
Path slice.| Modifier and Type | Field and Description |
|---|---|
java.nio.file.Path |
path
The
Path. |
inflatedLengthHint, isDeflatedZipEntry, nestedJarHandler, parentSlice, sliceLength, sliceStartPos| Constructor and Description |
|---|
PathSlice(java.nio.file.Path path,
boolean isDeflatedZipEntry,
long inflatedLengthHint,
NestedJarHandler nestedJarHandler)
Constructor for toplevel file slice.
|
PathSlice(java.nio.file.Path path,
NestedJarHandler nestedJarHandler)
Constructor for toplevel file slice.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the slice.
|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
byte[] |
load()
Load the slice as a byte array.
|
RandomAccessReader |
randomAccessReader()
Read directly from FileChannel (slow path, but handles >2GB).
|
java.nio.ByteBuffer |
read()
Read the slice into a
ByteBuffer (or memory-map the slice to a MappedByteBuffer, if
ClassGraph.enableMemoryMapping() was called.) |
Slice |
slice(long offset,
long length,
boolean isDeflatedZipEntry,
long inflatedLengthHint)
Slice the file.
|
loadAsString, open, openpublic PathSlice(java.nio.file.Path path,
boolean isDeflatedZipEntry,
long inflatedLengthHint,
NestedJarHandler nestedJarHandler)
throws java.io.IOException
path - the pathisDeflatedZipEntry - 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 handlerjava.io.IOException - if the file cannot be opened.public PathSlice(java.nio.file.Path path,
NestedJarHandler nestedJarHandler)
throws java.io.IOException
path - the pathnestedJarHandler - the nested jar handlerjava.io.IOException - if the file cannot be opened.public Slice slice(long offset, long length, boolean isDeflatedZipEntry, long inflatedLengthHint)
slice in class 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.public RandomAccessReader randomAccessReader()
randomAccessReader in class Slicepublic byte[] load()
throws java.io.IOException
public java.nio.ByteBuffer read()
throws java.io.IOException
ByteBuffer (or memory-map the slice to a MappedByteBuffer, if
ClassGraph.enableMemoryMapping() was called.)