|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jaudiotagger.audio.asf.io.ChunkContainerReader<ChunkType>
ChunkType
- The ChunkContainer
instance, the implementation will
create.abstract class ChunkContainerReader<ChunkType extends ChunkContainer>
This class represents a reader implementation, which is able to read ASF
objects (chunks) which store other objects (chunks) within them.
Field Summary | |
---|---|
protected boolean |
eachChunkOnce
If true each chunk type will only be read once. |
protected boolean |
hasFailingReaders
If true due to a registered
chunk reader, all InputStream objects passed to
read(GUID, InputStream, long) must support mark/reset. |
protected static java.util.logging.Logger |
LOGGER
Logger |
static int |
READ_LIMIT
Within this range, a ChunkReader should be aware if it fails. |
protected java.util.Map<GUID,ChunkReader> |
readerMap
Registers GUIDs to their reader classes. |
Constructor Summary | |
---|---|
protected |
ChunkContainerReader(java.util.List<java.lang.Class<? extends ChunkReader>> toRegister,
boolean readChunkOnce)
Creates a reader instance, which only utilizes the given list of chunk readers. |
Method Summary | ||
---|---|---|
protected void |
checkStream(java.io.InputStream stream)
Checks for the constraints of this class. |
|
protected abstract ChunkType |
createContainer(long streamPosition,
java.math.BigInteger chunkLength,
java.io.InputStream stream)
This method is called by read(GUID, InputStream, long) in order
to create the resulting object. |
|
protected ChunkReader |
getReader(GUID guid)
Gets a configured reader instance for ASF objects (chunks) with the specified guid . |
|
protected boolean |
isReaderAvailable(GUID guid)
Tests whether getReader(GUID) won't return null . |
|
ChunkType |
read(GUID guid,
java.io.InputStream stream,
long chunkStart)
This Method implements the reading of a chunk container. |
|
private
|
register(java.lang.Class<T> toRegister)
Registers the given reader. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jaudiotagger.audio.asf.io.ChunkReader |
---|
canFail, getApplyingIds |
Field Detail |
---|
protected static final java.util.logging.Logger LOGGER
public static final int READ_LIMIT
ChunkReader
should be aware if it fails.
protected final boolean eachChunkOnce
true
each chunk type will only be read once.
protected boolean hasFailingReaders
true
due to a registered
chunk reader, all InputStream
objects passed to
read(GUID, InputStream, long)
must support mark/reset.
protected final java.util.Map<GUID,ChunkReader> readerMap
Constructor Detail |
---|
protected ChunkContainerReader(java.util.List<java.lang.Class<? extends ChunkReader>> toRegister, boolean readChunkOnce)
toRegister
- List of ChunkReader
class instances, which are to be
utilized by the instance.readChunkOnce
- if true
, each chunk type (identified by chunk
GUID) will handled only once, if a reader is available, other
chunks will be discarded.Method Detail |
---|
protected void checkStream(java.io.InputStream stream) throws java.lang.IllegalArgumentException
stream
- stream to test.
java.lang.IllegalArgumentException
- If stream does not meet the requirements.protected abstract ChunkType createContainer(long streamPosition, java.math.BigInteger chunkLength, java.io.InputStream stream) throws java.io.IOException
read(GUID, InputStream, long)
in order
to create the resulting object. Implementations of this class should now
return a new instance of their implementation specific result AND
all data should be read, until the list of chunks starts. (The
Chunk.getChunkEnd()
must return a sane result, too)
streamPosition
- position of the stream, the chunk starts.chunkLength
- the length of the chunk (from chunk header)stream
- to read the implementation specific information.
java.io.IOException
- On I/O Errors and Invalid data.protected ChunkReader getReader(GUID guid)
guid
.
guid
- GUID which identifies the chunk to be read.
null
if not
registered.protected boolean isReaderAvailable(GUID guid)
getReader(GUID)
won't return null
.
guid
- GUID which identifies the chunk to be read.
true
if a reader is available.public ChunkType read(GUID guid, java.io.InputStream stream, long chunkStart) throws java.io.IOException, java.lang.IllegalArgumentException
read
in interface ChunkReader
guid
- GUID of the currently read container.stream
- Stream which contains the chunk container.chunkStart
- The start of the chunk container from stream start.0
here.
null
if no valid data found, else a Wrapper
containing all supported data.
java.io.IOException
- Read errors.
java.lang.IllegalArgumentException
- If one used ChunkReader
could
fail and the stream source
doesn't support mark/reset.private <T extends ChunkReader> void register(java.lang.Class<T> toRegister)
T
- The actual reader implementation.toRegister
- chunk reader which is to be registered.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |