public class CentralDirectory extends Object
| Modifier and Type | Field and Description |
|---|---|
long |
centralDirectoryOffset
The location of the central directory
|
Map<String,CentralDirectoryFileHeader> |
entries
The entries of the central directory
|
| Constructor and Description |
|---|
CentralDirectory() |
| Modifier and Type | Method and Description |
|---|---|
long |
getEntrySize(String name)
Returns the size of the specified entry (local header + compressed data).
|
void |
read(SeekableByteChannel channel) |
void |
removeEntry(String name)
Removes the entry specified if it exists.
|
byte[] |
toBytes()
Returns the central directory as a byte array.
|
void |
write(SeekableByteChannel channel)
Write the central directory at the current position of the channel and update the offset.
|
void |
write(SeekableByteChannel channel,
long offset)
Write the central directory at the current position of the channel but don't update the offset.
|
public long centralDirectoryOffset
public Map<String,CentralDirectoryFileHeader> entries
public CentralDirectory()
public long getEntrySize(String name)
name - the name of the entrypublic void read(SeekableByteChannel channel) throws IOException
IOExceptionpublic void removeEntry(String name)
name - the name of the entry to removepublic byte[] toBytes() throws IOException
IOExceptionpublic void write(SeekableByteChannel channel) throws IOException
channel - the channel to write toIOExceptionpublic void write(SeekableByteChannel channel, long offset) throws IOException
channel - the channel to write tooffset - the offset of the central directory written in the End of Central Directory RecordIOExceptionCopyright © 2012–2025. All rights reserved.