| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ChunkReader |
|
| 1.0;1 |
| 1 | package org.jaudiotagger.audio.asf.io; | |
| 2 | ||
| 3 | import org.jaudiotagger.audio.asf.data.Chunk; | |
| 4 | import org.jaudiotagger.audio.asf.data.GUID; | |
| 5 | ||
| 6 | import java.io.IOException; | |
| 7 | import java.io.InputStream; | |
| 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 | * Tells whether the reader can fail to return a valid chunk.<br> | |
| 18 | * The current Use would be a modified version of {@link StreamChunkReader}, | |
| 19 | * which is configured to only manage audio streams. However, the primary | |
| 20 | * GUID for audio and video streams is the same. So if a stream shows itself | |
| 21 | * to be a video stream, the reader would return <code>null</code>.<br> | |
| 22 | * | |
| 23 | * @return <code>true</code>, if further analysis of the chunk can show, | |
| 24 | * that the reader is not applicable, despite the header GUID | |
| 25 | * {@linkplain #getApplyingIds() identification} told it can handle | |
| 26 | * the chunk. | |
| 27 | */ | |
| 28 | boolean canFail(); | |
| 29 | ||
| 30 | /** | |
| 31 | * Returns the GUIDs identifying the types of chunk, this reader will parse.<br> | |
| 32 | * | |
| 33 | * @return the GUIDs identifying the types of chunk, this reader will parse.<br> | |
| 34 | */ | |
| 35 | GUID[] getApplyingIds(); | |
| 36 | ||
| 37 | /** | |
| 38 | * Parses the chunk. | |
| 39 | * | |
| 40 | * @param guid | |
| 41 | * the GUID of the chunks header, which is about to be read. | |
| 42 | * @param stream | |
| 43 | * source to read chunk from.<br> | |
| 44 | * No {@link GUID} is expected at the currents stream position. | |
| 45 | * The length of the chunk is about to follow. | |
| 46 | * @param streamPosition | |
| 47 | * the position in stream, the chunk starts.<br> | |
| 48 | * @return the read chunk. (Mostly a subclass of {@link Chunk}).<br> | |
| 49 | * @throws IOException | |
| 50 | * On I/O Errors. | |
| 51 | */ | |
| 52 | Chunk read(GUID guid, InputStream stream, long streamPosition) | |
| 53 | throws IOException; | |
| 54 | } |