public class ChunkContainer extends Chunk
Chunk
objects, and is
itself an ASF object (chunk).StreamChunk
) may only be inserted once.Modifier and Type | Field and Description |
---|---|
private java.util.Map<GUID,java.util.List<Chunk>> |
chunkTable
|
private static java.util.Set<GUID> |
MULTI_CHUNKS
Stores the
GUID instances, which are allowed multiple times
within an ASF header. |
chunkLength, guid, position
Constructor and Description |
---|
ChunkContainer(GUID chunkGUID,
long pos,
java.math.BigInteger length)
Creates an instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addChunk(Chunk toAdd)
Adds a chunk to the container.
|
protected java.util.List<Chunk> |
assertChunkList(GUID lookFor)
|
protected static boolean |
chunkstartsUnique(ChunkContainer container)
Tests whether all stored chunks have a unique starting position among
their brothers.
|
java.util.Collection<Chunk> |
getChunks()
Returns a collection of all contained chunks.
|
protected Chunk |
getFirst(GUID lookFor,
java.lang.Class<? extends Chunk> instanceOf)
Looks for the first stored chunk which has the given GUID.
|
boolean |
hasChunkByGUID(GUID lookFor)
|
java.lang.String |
prettyPrint(java.lang.String prefix)
This method creates a String containing useful information prepared to be
printed on STD-OUT.
|
java.lang.String |
prettyPrint(java.lang.String prefix,
java.lang.String containerInfo)
Nearly the same as
prettyPrint(String) however, additional
information can be injected below the Chunk.prettyPrint(String)
output and the listing of the contained chunks. |
getChunckEnd, getChunkEnd, getChunkLength, getGuid, getPosition, setPosition, toString
private static final java.util.Set<GUID> MULTI_CHUNKS
GUID
instances, which are allowed multiple times
within an ASF header.public ChunkContainer(GUID chunkGUID, long pos, java.math.BigInteger length)
chunkGUID
- the GUID which identifies the chunk.pos
- the position of the chunk within the stream.length
- the length of the chunk.protected static boolean chunkstartsUnique(ChunkContainer container)
container
- the container to test.true
if all chunks are located at an unique
position. However, no intersection is tested.public void addChunk(Chunk toAdd)
toAdd
- The chunk which is to be added.java.lang.IllegalArgumentException
- If a chunk of same type is already added, except for
StreamChunk
.protected java.util.List<Chunk> assertChunkList(GUID lookFor)
lookFor
- The GUID to get list for.public java.util.Collection<Chunk> getChunks()
protected Chunk getFirst(GUID lookFor, java.lang.Class<? extends Chunk> instanceOf)
lookFor
- GUID to look up.instanceOf
- The class which must additionally be matched.null
if no chunk was found, or the stored instance
doesn't match.public boolean hasChunkByGUID(GUID lookFor)
lookFor
- GUID to look up.true
if chunk with specified GUID has been added.public java.lang.String prettyPrint(java.lang.String prefix)
prettyPrint
in class Chunk
prefix
- each line gets this string prepended.public java.lang.String prettyPrint(java.lang.String prefix, java.lang.String containerInfo)
prettyPrint(String)
however, additional
information can be injected below the Chunk.prettyPrint(String)
output and the listing of the contained chunks.prefix
- The prefix to prepend.containerInfo
- Information to inject.Copyright © 2005-2013 java.net. All Rights Reserved.