| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ChunkReader |
|
| 1.0;1 |
| 1 | package org.jaudiotagger.audio.asf.io; | |
| 2 | ||
| 3 | import java.io.IOException; | |
| 4 | import java.io.InputStream; | |
| 5 | ||
| 6 | import org.jaudiotagger.audio.asf.data.Chunk; | |
| 7 | import org.jaudiotagger.audio.asf.data.GUID; | |
| 8 | ||
| 9 | /** | |
| 10 | * A ChunkReader provides methods for reading an ASF chunk.<br> | |
| 11 | * | |
| 12 | * @author Christian Laireiter | |
| 13 | */ | |
| 14 | public interface ChunkReader | |
| 15 | { | |
| 16 | ||
| 17 | /** | |
| 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> | |
| 23 | * | |
| 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. | |
| 27 | */ | |
| 28 | public boolean canFail(); | |
| 29 | ||
| 30 | /** | |
| 31 | * Returns the GUID identifying the type of chunk, this reader will parse.<br> | |
| 32 | * | |
| 33 | * @return the GUID identifying the type of chunk, this reader will parse.<br> | |
| 34 | */ | |
| 35 | public GUID getApplyingId(); | |
| 36 | ||
| 37 | /** | |
| 38 | * Parses the chunk. | |
| 39 | * | |
| 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. | |
| 46 | */ | |
| 47 | public Chunk read(GUID guid, InputStream stream, long streamPosition) throws IOException; | |
| 48 | } |