org.freecompany.redline.header
public abstract class AbstractHeader extends Object
Nested Class Summary | |
---|---|
abstract class | AbstractHeader.AbstractEntry<T> |
interface | AbstractHeader.Entry<T> |
interface | AbstractHeader.Tag |
Field Summary | |
---|---|
protected Map<Integer,Entry<?>> | entries |
protected static int | ENTRY_SIZE |
protected static int | HEADER_HEADER_SIZE |
protected static int | MAGIC_WORD |
protected Map<Entry<?>,Integer> | pending |
protected Map<Integer,AbstractHeader.Tag> | tags |
Method Summary | |
---|---|
int | count() |
Entry<?> | createEntry(int tag, int type, int count) |
protected Entry<?> | createEntry(int type) |
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. |
Entry<?> | getEntry(AbstractHeader.Tag tag) |
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<Entry<?>,Integer> | getPending() |
protected abstract boolean | pad() |
int | read(ReadableByteChannel in)
Reads the entire header contents for this channel and returns the number of entries
found. |
Entry<?> | readEntry(int tag, int type, int offset, int count, ByteBuffer data) |
void | removeEntry(Entry<?> entry) |
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, Entry<?> entry, int offset) |
Returns: the total number of bytes written to the data section of the file.