public class FileSlice extends Slice
File slice.| Modifier and Type | Field and Description |
|---|---|
java.io.File |
file
The
File. |
java.io.RandomAccessFile |
raf
The
RandomAccessFile opened on the File. |
inflatedLengthHint, isDeflatedZipEntry, nestedJarHandler, parentSlice, sliceLength, sliceStartPos| Constructor and Description |
|---|
FileSlice(java.io.File file,
boolean isDeflatedZipEntry,
long inflatedLengthHint,
NestedJarHandler nestedJarHandler,
LogNode log)
Constructor for toplevel file slice.
|
FileSlice(java.io.File file,
NestedJarHandler nestedJarHandler,
LogNode log)
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 final java.io.File file
File.public java.io.RandomAccessFile raf
RandomAccessFile opened on the File.public FileSlice(java.io.File file,
boolean isDeflatedZipEntry,
long inflatedLengthHint,
NestedJarHandler nestedJarHandler,
LogNode log)
throws java.io.IOException
file - the fileisDeflatedZipEntry - 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 handlerlog - the logjava.io.IOException - if the file cannot be opened.public FileSlice(java.io.File file,
NestedJarHandler nestedJarHandler,
LogNode log)
throws java.io.IOException
file - the filenestedJarHandler - the nested jar handlerlog - the logjava.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.)