| Modifier and Type | Class and Description |
|---|---|
class |
AbstractHeader.AbstractEntry<T> |
static interface |
AbstractHeader.Entry<T> |
static interface |
AbstractHeader.Tag |
| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
AbstractHeader() |
| Modifier and Type | Method and Description |
|---|---|
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) |
<T> AbstractHeader.Entry<T> |
createEntry(AbstractHeader.Tag tag,
int type,
T values) |
<T> AbstractHeader.Entry<T> |
createEntry(AbstractHeader.Tag tag,
T values) |
protected AbstractHeader.Entry<?> |
createEntry(int type) |
AbstractHeader.Entry<?> |
createEntry(int tag,
int type,
int count) |
<T> AbstractHeader.Entry<T> |
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) |
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
protected abstract boolean pad()
public int read(ReadableByteChannel in) throws IOException
in - the ReadableByteChannel to readIOException - there was an IO errorpublic int write(WritableByteChannel out) throws IOException
out - the WritableByteChannel to output toIOException - there was an IO errorpublic int count()
protected ByteBuffer getHeader() throws IOException
IOException - there was an IO errorprotected ByteBuffer getIndex() throws IOException
IOException - there was an IO errorprotected ByteBuffer getData(ByteBuffer index) throws IOException
index - ByteBuffer of the indexIOException - there was an IO errorprotected 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.tag - the tagcount - the countpublic 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)
Copyright © 2015. All Rights Reserved.