|
||||||||||
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<AsfHeader> org.jaudiotagger.audio.asf.io.AsfHeaderReader
public class AsfHeaderReader
This class reads an ASF header out of an input stream an creates an
AsfHeader
object if successful.
For now only ASF ver 1.0 is supported, because ver 2.0 seems not to be used
anywhere.
ASF headers contains other chunks. As of this other readers of current
package are called from within.
Field Summary | |
---|---|
private static GUID[] |
APPLYING
The GUID this reader applies to |
private static AsfHeaderReader |
FULL_READER
ASF reader configured to extract all information. |
private static AsfHeaderReader |
INFO_READER
ASF reader configured to just extract information about audio streams. If the ASF file only contains one audio stream it works fine. |
private static AsfHeaderReader |
TAG_READER
ASF reader configured to just extract metadata information. |
Fields inherited from class org.jaudiotagger.audio.asf.io.ChunkContainerReader |
---|
eachChunkOnce, hasFailingReaders, LOGGER, READ_LIMIT, readerMap |
Constructor Summary | |
---|---|
AsfHeaderReader(java.util.List<java.lang.Class<? extends ChunkReader>> toRegister,
boolean readChunkOnce)
Creates an instance of this reader. |
Method Summary | |
---|---|
boolean |
canFail()
Tells whether the reader can fail to return a valid chunk. The current Use would be a modified version of StreamChunkReader ,
which is configured to only manage audio streams. |
protected AsfHeader |
createContainer(long streamPosition,
java.math.BigInteger chunkLength,
java.io.InputStream stream)
This method is called by ChunkContainerReader.read(GUID, InputStream, long) in order
to create the resulting object. |
private static java.io.InputStream |
createStream(java.io.RandomAccessFile raf)
Creates a Stream that will read from the specified RandomAccessFile ; |
GUID[] |
getApplyingIds()
Returns the GUIDs identifying the types of chunk, this reader will parse. |
static AsfHeader |
readHeader(java.io.File file)
This method extracts the full ASF-Header from the given file. If no header could be extracted null is returned. |
static AsfHeader |
readHeader(java.io.RandomAccessFile file)
This method tries to extract a full ASF-header out of the given stream. |
static AsfHeader |
readInfoHeader(java.io.RandomAccessFile file)
This method tries to extract an ASF-header out of the given stream, which only contains information about the audio stream. If no header could be extracted null is returned. |
static AsfHeader |
readTagHeader(java.io.RandomAccessFile file)
This method tries to extract an ASF-header out of the given stream, which only contains metadata. If no header could be extracted null is returned. |
void |
setExtendedHeaderReader(AsfExtHeaderReader extReader)
Sets the AsfExtHeaderReader , which is to be used, when an header
extension object is found. |
Methods inherited from class org.jaudiotagger.audio.asf.io.ChunkContainerReader |
---|
checkStream, getReader, isReaderAvailable, read |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final GUID[] APPLYING
private static final AsfHeaderReader FULL_READER
private static final AsfHeaderReader INFO_READER
private static final AsfHeaderReader TAG_READER
Constructor Detail |
---|
public AsfHeaderReader(java.util.List<java.lang.Class<? extends ChunkReader>> toRegister, boolean readChunkOnce)
toRegister
- The chunk readers to utilize.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 |
---|
private static java.io.InputStream createStream(java.io.RandomAccessFile raf)
RandomAccessFile
;
raf
- data source to read from.
public static AsfHeader readHeader(java.io.File file) throws java.io.IOException
null
is returned.
file
- the ASF file to read.null
if no supported ASF
header was found.
java.io.IOException
- on I/O Errors.public static AsfHeader readHeader(java.io.RandomAccessFile file) throws java.io.IOException
null
is returned.
file
- File which contains the ASF header.
null
if no supported ASF
header was found.
java.io.IOException
- Read errorspublic static AsfHeader readInfoHeader(java.io.RandomAccessFile file) throws java.io.IOException
null
is returned.
file
- File which contains the ASF header.
null
if no supported ASF
header was found.
java.io.IOException
- Read errorspublic static AsfHeader readTagHeader(java.io.RandomAccessFile file) throws java.io.IOException
null
is returned.
file
- File which contains the ASF header.
null
if no supported ASF
header was found.
java.io.IOException
- Read errorspublic boolean canFail()
StreamChunkReader
,
which is configured to only manage audio streams. However, the primary
GUID for audio and video streams is the same. So if a stream shows itself
to be a video stream, the reader would return null
.
true
, if further analysis of the chunk can show,
that the reader is not applicable, despite the header GUID
identification told it can handle
the chunk.protected AsfHeader createContainer(long streamPosition, java.math.BigInteger chunkLength, java.io.InputStream stream) throws java.io.IOException
ChunkContainerReader.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)
createContainer
in class ChunkContainerReader<AsfHeader>
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.public GUID[] getApplyingIds()
public void setExtendedHeaderReader(AsfExtHeaderReader extReader)
AsfExtHeaderReader
, which is to be used, when an header
extension object is found.
extReader
- header extension object reader.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |