|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.zipxap.vfs.VFSSector
public class VFSSector
A Sector is X bytes of contiguous data, where X is one of six sizes; Header, Small, Medium, Large, Jumbo, Giant.
Header sectors are extremely small and begin with byte 'H' (or 'h' if empty). The next 3 bytes are a spacer to make the other sector sizes divisible by the header sector size, The next 4 bytes are the (int) size of the entry sector, followed by 8 bytes that contain the (long) location of the entry sector. The next 8 bytes are the (long) size of the data sector. Like all sectors, the last 8 bytes contain the (long) address of the sector contain the location of the next sector in the series, or -1 if this is the last sector in the series.
This means, for a given sector size X, there are X-9 bytes available to store data.
| Milestone | Who | Date, Time |
|---|---|---|
| Initial Version | K Penrose | June 2009 |
** Note that this table is not intended as an exhaustive list of subtle changes. It is intended to list changes that break the compatibility of older code, or major enhancements/rewrites
| Field Summary | |
|---|---|
long |
_dataIndex
|
static long |
DATA_START_OFFSET
|
static int |
HEADER_DATA_SIZE_OFFSET
|
static int |
HEADER_ENTRY_LOCATION_OFFSET
|
static int |
HEADER_ENTRY_SIZE_OFFSET
|
| Constructor Summary | |
|---|---|
VFSSector(LowLevelManager mgr,
long fileLocation)
Create a new sector object to represent an existing sector |
|
VFSSector(LowLevelManager mgr,
long fileLocation,
SectorType sectorType)
Create a new sector object to represent an existing sector |
|
| Method Summary | |
|---|---|
static VFSSector |
appendNewEmptySectors(LowLevelManager mgr,
SectorType type)
Create a new empty sector and append it to the end of the archive. |
void |
convertToEmpty(boolean convertRemainingLinkedSectors)
Converts this sector to an empty sector and, optionally, any remaining linked sectors. |
void |
dumpLinkedSectors()
Converts the remaining linked sectors to empty sectors |
long |
getDataLength()
Retrieves the length (in bytes) of the data. |
ValuePair<java.lang.Long,VFSSector> |
getDataSector()
Retrieves the data sector from a header sector. |
Entry |
getEntry()
Retrieve the Entry contained in this sector |
int |
getEntryLength()
Retrieves the length (in bytes) of the entry. |
ValuePair<java.lang.Integer,VFSSector> |
getEntrySector()
|
ValuePair<java.lang.Integer,VFSSector> |
getEntrySector(boolean createIfItDoesntExist)
Retrieves the entry sector (if this is a header sector). |
java.lang.Long |
getEntrySectorLocation()
Retrieves the location of the entry sector, if it has one. |
long |
getFileLocation()
|
VFSSector |
getNextSector()
Retrieves the next sector in the series. |
java.lang.Long |
getNextSectorLocation()
Retrieves the next sector in the series (which is also the dataSector if this is a header). |
int |
getNextSectorOffset()
|
int |
getRemainingDataLengthBytes()
Determine if there is more data in this sector to be read. |
int |
getSectorSize()
|
SectorType |
getSectorType()
|
void |
initPointer()
Initialize the sector to read the data, starting at the first data location within the sector. |
boolean |
isEmpty()
|
VFSSector |
linkNewSector(SectorType sectorType)
Returns the currently linked sector if there is one, else it creates a new one. |
VFSSector |
morphThisSectorToNextSector()
This is a helper method that is functionally similar to reindexSector(getNextSector().getFileLocation()) (but safe). |
int |
read()
|
int |
readNotBuffered()
|
void |
reindexSector(long newFileLocation)
Reindex this sector using the specified location as the file location of this sector. |
void |
setDataLength(long length)
|
void |
setEntryLength(long length)
|
void |
setEntrySectorLocation(java.lang.Long entrySectorLocation)
Set the location of the entry sector. |
void |
setNextSectorLocation(java.lang.Long nextSectorLocation)
Sets the location of the next sector in the series (which is also the dataSector if this is a header). |
void |
setSectorType(SectorType sectorType)
|
int |
writeData(byte[] data,
int offset,
int length)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final long DATA_START_OFFSET
public static final int HEADER_ENTRY_SIZE_OFFSET
public static final int HEADER_ENTRY_LOCATION_OFFSET
public static final int HEADER_DATA_SIZE_OFFSET
public long _dataIndex
| Constructor Detail |
|---|
public VFSSector(LowLevelManager mgr,
long fileLocation)
mgr - fileLocation -
public VFSSector(LowLevelManager mgr,
long fileLocation,
SectorType sectorType)
mgr - fileLocation - | Method Detail |
|---|
public static VFSSector appendNewEmptySectors(LowLevelManager mgr,
SectorType type)
mgr -
public SectorType getSectorType()
public void setSectorType(SectorType sectorType)
public VFSSector getNextSector()
public java.lang.Long getNextSectorLocation()
public void setNextSectorLocation(java.lang.Long nextSectorLocation)
public ValuePair<java.lang.Long,VFSSector> getDataSector()
public long getDataLength()
public void setDataLength(long length)
public int getEntryLength()
public void setEntryLength(long length)
public ValuePair<java.lang.Integer,VFSSector> getEntrySector()
public java.lang.Long getEntrySectorLocation()
public void setEntrySectorLocation(java.lang.Long entrySectorLocation)
public ValuePair<java.lang.Integer,VFSSector> getEntrySector(boolean createIfItDoesntExist)
public void reindexSector(long newFileLocation)
newFileLocation - public VFSSector morphThisSectorToNextSector()
null if there is no next sector.public VFSSector linkNewSector(SectorType sectorType)
public void convertToEmpty(boolean convertRemainingLinkedSectors)
public void dumpLinkedSectors()
public void initPointer()
public int read()
public int readNotBuffered()
public int getRemainingDataLengthBytes()
public long getFileLocation()
public int getSectorSize()
public boolean isEmpty()
public int getNextSectorOffset()
public int writeData(byte[] data,
int offset,
int length)
public Entry getEntry()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||