|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.freecompany.redline.header.AbstractHeader
public abstract class AbstractHeader
| Nested Class Summary | |
|---|---|
class |
AbstractHeader.AbstractEntry<T>
|
static interface |
AbstractHeader.Entry<T>
|
static interface |
AbstractHeader.Tag
|
| Field Summary | |
|---|---|
protected int |
endPos
|
protected Map<Integer,AbstractHeader.Entry<?>> |
entries
|
protected static int |
ENTRY_SIZE
|
protected static int |
HEADER_HEADER_SIZE
|
protected static int |
MAGIC_WORD
|
protected Map<AbstractHeader.Entry<?>,Integer> |
pending
|
protected int |
startPos
|
protected Map<Integer,AbstractHeader.Tag> |
tags
|
| Constructor Summary | |
|---|---|
AbstractHeader()
|
|
| Method Summary | ||
|---|---|---|
AbstractHeader.Entry<?> |
addEntry(AbstractHeader.Tag tag,
int count)
Adds a pending entry to this header. |
|
int |
count()
|
|
AbstractHeader.Entry<String[]> |
createEntry(AbstractHeader.Tag tag,
CharSequence value)
|
|
AbstractHeader.Entry<int[]> |
createEntry(AbstractHeader.Tag tag,
int value)
|
|
|
createEntry(AbstractHeader.Tag tag,
int type,
T values)
|
|
|
createEntry(AbstractHeader.Tag tag,
T values)
|
|
protected AbstractHeader.Entry<?> |
createEntry(int type)
|
|
AbstractHeader.Entry<?> |
createEntry(int tag,
int type,
int count)
|
|
|
createEntry(int tag,
int type,
T values)
|
|
protected ByteBuffer |
getData(ByteBuffer index)
Writes the data section of the file, starting at the current position which must be immediately after the header section. |
|
int |
getEndPos()
|
|
AbstractHeader.Entry<?> |
getEntry(AbstractHeader.Tag tag)
|
|
AbstractHeader.Entry<?> |
getEntry(int tag)
|
|
protected ByteBuffer |
getHeader()
Memory maps the portion of the destination file that will contain the header structure header and advances the file channels position. |
|
protected ByteBuffer |
getIndex()
Memory maps the portion of the destination file that will contain the index structure header and advances the file channels position. |
|
Map<AbstractHeader.Entry<?>,Integer> |
getPending()
|
|
int |
getStartPos()
|
|
protected abstract boolean |
pad()
|
|
int |
read(ReadableByteChannel in)
Reads the entire header contents for this channel and returns the number of entries found. |
|
AbstractHeader.Entry<?> |
readEntry(int tag,
int type,
int offset,
int count,
ByteBuffer data)
|
|
void |
removeEntry(AbstractHeader.Entry<?> entry)
|
|
void |
setEndPos(int endPos)
|
|
void |
setStartPos(int startPos)
|
|
String |
toString()
|
|
int |
write(WritableByteChannel out)
Writes this header section to the provided file at the current position and returns the required padding. |
|
protected int |
writeData(Collection<ByteBuffer> buffers,
ByteBuffer index,
AbstractHeader.Entry<?> entry,
int offset)
|
|
void |
writePending(FileChannel channel)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final int HEADER_HEADER_SIZE
protected static final int ENTRY_SIZE
protected static final int MAGIC_WORD
protected final Map<Integer,AbstractHeader.Tag> tags
protected final Map<Integer,AbstractHeader.Entry<?>> entries
protected final Map<AbstractHeader.Entry<?>,Integer> pending
protected int startPos
protected int endPos
| Constructor Detail |
|---|
public AbstractHeader()
| Method Detail |
|---|
protected abstract boolean pad()
public int read(ReadableByteChannel in)
throws IOException
IOException
public int write(WritableByteChannel out)
throws IOException
IOExceptionpublic int count()
protected ByteBuffer getHeader()
throws IOException
IOException
protected ByteBuffer getIndex()
throws IOException
IOException
protected ByteBuffer getData(ByteBuffer index)
throws IOException
IOException
protected int writeData(Collection<ByteBuffer> buffers,
ByteBuffer index,
AbstractHeader.Entry<?> entry,
int offset)
public void writePending(FileChannel channel)
public Map<AbstractHeader.Entry<?>,Integer> getPending()
public void removeEntry(AbstractHeader.Entry<?> entry)
public AbstractHeader.Entry<?> getEntry(AbstractHeader.Tag tag)
public AbstractHeader.Entry<?> getEntry(int tag)
public AbstractHeader.Entry<String[]> createEntry(AbstractHeader.Tag tag,
CharSequence value)
public AbstractHeader.Entry<int[]> createEntry(AbstractHeader.Tag tag,
int value)
public <T> AbstractHeader.Entry<T> createEntry(AbstractHeader.Tag tag,
T values)
public <T> AbstractHeader.Entry<T> createEntry(AbstractHeader.Tag tag,
int type,
T values)
public <T> AbstractHeader.Entry<T> createEntry(int tag,
int type,
T values)
public AbstractHeader.Entry<?> addEntry(AbstractHeader.Tag tag,
int count)
writePending(java.nio.channels.FileChannel) on this
object.
public AbstractHeader.Entry<?> readEntry(int tag,
int type,
int offset,
int count,
ByteBuffer data)
public AbstractHeader.Entry<?> createEntry(int tag,
int type,
int count)
protected AbstractHeader.Entry<?> createEntry(int type)
public int getEndPos()
public void setEndPos(int endPos)
public int getStartPos()
public void setStartPos(int startPos)
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||