public class ChunkContainer extends Chunk
Chunk
objects, and is
itself an ASF object (chunk).StreamChunk
) may only be inserted once.chunkLength, guid, position
Constructor and Description |
---|
ChunkContainer(GUID chunkGUID,
long pos,
BigInteger length)
Creates an instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addChunk(Chunk toAdd)
Adds a chunk to the container.
|
protected List<Chunk> |
assertChunkList(GUID lookFor)
|
protected static boolean |
chunkstartsUnique(ChunkContainer container)
Tests whether all stored chunks have a unique starting position among
their brothers.
|
Collection<Chunk> |
getChunks()
Returns a collection of all contained chunks.
|
protected Chunk |
getFirst(GUID lookFor,
Class<? extends Chunk> instanceOf)
Looks for the first stored chunk which has the given GUID.
|
boolean |
hasChunkByGUID(GUID lookFor)
|
String |
prettyPrint(String prefix)
This method creates a String containing useful information prepared to be
printed on STD-OUT.
|
String |
prettyPrint(String prefix,
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
public ChunkContainer(GUID chunkGUID, long pos, 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.IllegalArgumentException
- If a chunk of same type is already added, except for
StreamChunk
.protected List<Chunk> assertChunkList(GUID lookFor)
lookFor
- The GUID to get list for.public Collection<Chunk> getChunks()
protected Chunk getFirst(GUID lookFor, 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 String prettyPrint(String prefix)
prettyPrint
in class Chunk
prefix
- each line gets this string prepended.public String prettyPrint(String prefix, 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–2020 jthink.net. All rights reserved.