Fields Summary |
---|
private static final org.jaudiotagger.audio.asf.data.GUID[] | APPLYINGThe GUID this reader {@linkplain #getApplyingIds() applies to} |
private static final AsfHeaderReader | FULL_READERASF reader configured to extract all information. |
private static final AsfHeaderReader | INFO_READERASF reader configured to just extract information about audio streams.
If the ASF file only contains one audio stream it works fine.
|
private static final AsfHeaderReader | TAG_READERASF reader configured to just extract metadata information.
|
Methods Summary |
---|
public boolean | canFail(){@inheritDoc}
return false;
|
protected org.jaudiotagger.audio.asf.data.AsfHeader | createContainer(long streamPosition, java.math.BigInteger chunkLength, java.io.InputStream stream){@inheritDoc}
final long chunkCount = Utils.readUINT32(stream);
/*
* 2 reserved bytes. first should be equal to 0x01 and second 0x02. ASF
* specification suggests to not read the content if second byte is not
* 0x02.
*/
if (stream.read() != 1) {
throw new IOException("No ASF"); //$NON-NLS-1$
}
if (stream.read() != 2) {
throw new IOException("No ASF"); //$NON-NLS-1$
}
/*
* Creating the resulting object
*/
return new AsfHeader(streamPosition, chunkLength, chunkCount);
|
private static java.io.InputStream | createStream(java.io.RandomAccessFile raf)Creates a Stream that will read from the specified
{@link RandomAccessFile};
final List<Class<? extends ChunkReader>> readers = new ArrayList<Class<? extends ChunkReader>>();
readers.add(FileHeaderReader.class);
readers.add(StreamChunkReader.class);
INFO_READER = new AsfHeaderReader(readers, true);
readers.clear();
readers.add(ContentDescriptionReader.class);
readers.add(ContentBrandingReader.class);
readers.add(LanguageListReader.class);
readers.add(MetadataReader.class);
/*
* Create the header extension object readers with just content
* description reader, extended content description reader, language
* list reader and both metadata object readers.
*/
final AsfExtHeaderReader extReader = new AsfExtHeaderReader(readers,
true);
final AsfExtHeaderReader extReader2 = new AsfExtHeaderReader(readers,
true);
TAG_READER = new AsfHeaderReader(readers, true);
TAG_READER.setExtendedHeaderReader(extReader);
readers.add(FileHeaderReader.class);
readers.add(StreamChunkReader.class);
readers.add(EncodingChunkReader.class);
readers.add(EncryptionChunkReader.class);
readers.add(StreamBitratePropertiesReader.class);
FULL_READER = new AsfHeaderReader(readers, false);
FULL_READER.setExtendedHeaderReader(extReader2);
return new FullRequestInputStream(new BufferedInputStream(
new RandomAccessFileInputstream(raf)));
|
public org.jaudiotagger.audio.asf.data.GUID[] | getApplyingIds(){@inheritDoc}
return APPLYING.clone();
|
public static org.jaudiotagger.audio.asf.data.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.
final InputStream stream = new FileInputStream(file);
final AsfHeader result = FULL_READER.read(Utils.readGUID(stream),
stream, 0);
stream.close();
return result;
|
public static org.jaudiotagger.audio.asf.data.AsfHeader | readHeader(java.io.RandomAccessFile file)This method tries to extract a full ASF-header out of the given stream.
If no header could be extracted null is returned.
final InputStream stream = createStream(file);
return FULL_READER.read(Utils.readGUID(stream), stream, 0);
|
public static org.jaudiotagger.audio.asf.data.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.
final InputStream stream = createStream(file);
return INFO_READER.read(Utils.readGUID(stream), stream, 0);
|
public static org.jaudiotagger.audio.asf.data.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.
final InputStream stream = createStream(file);
return TAG_READER.read(Utils.readGUID(stream), stream, 0);
|
public void | setExtendedHeaderReader(AsfExtHeaderReader extReader)Sets the {@link AsfExtHeaderReader}, which is to be used, when an header
extension object is found.
for (final GUID curr : extReader.getApplyingIds()) {
this.readerMap.put(curr, extReader);
}
|