1
package org.jaudiotagger.audio.asf.io;
3
import java.io.IOException;
4
import java.io.InputStream;
6
import org.jaudiotagger.audio.asf.data.Chunk;
7
import org.jaudiotagger.audio.asf.data.GUID;
10
* A ChunkReader provides methods for reading an ASF chunk.<br>
12
* @author Christian Laireiter
14
public interface ChunkReader
18
* Tells whether the reader can fail to return a valid chunk.<br>
19
* The current Use would be a modified version of {@link StreamChunkReader}, which
20
* is configured to only manage audio streams. However, the primary GUID for
21
* audio and video streams is the same. So if a stream shows itself to
22
* be a video stream, the reader would return <code>null</code>.<br>
24
* @return <code>true</code>, if further analysis of the chunk can show,
25
* that the reader is not applicable, despite the header GUID
26
* {@linkplain #getApplyingId() identification} told it can handle the chunk.
28
public boolean canFail();
31
* Returns the GUID identifying the type of chunk, this reader will parse.<br>
33
* @return the GUID identifying the type of chunk, this reader will parse.<br>
35
public GUID getApplyingId();
40
* @param guid the GUID of the chunks header, which is about to be read.
41
* @param stream source to read chunk from.<br> No {@link GUID} is expected at the currents stream position.
42
* The length of the chunk is about to follow.
43
* @param streamPosition the position in stream, the chunk starts.<br>
44
* @return the read chunk. (Mostly a subclass of {@link Chunk}).<br>
45
* @throws IOException On I/O Errors.
47
public Chunk read(GUID guid, InputStream stream, long streamPosition) throws IOException;