Package com.drew.metadata.wav
Class WavRiffHandler
- java.lang.Object
-
- com.drew.metadata.wav.WavRiffHandler
-
- All Implemented Interfaces:
RiffHandler
public class WavRiffHandler extends java.lang.Object implements RiffHandler
Implementation ofRiffHandlerspecialising in Wav support. Extracts data from chunk/list types:"INFO": artist, title, product, track number, date created, genre, comments, copyright, software, duration"fmt ": format, channels, samples/second, bytes/second, block alignment, bits/sample"data": duration
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String_currentListprivate WavDirectory_directory
-
Constructor Summary
Constructors Constructor Description WavRiffHandler(Metadata metadata)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddError(java.lang.String message)Registers an error message for consumption after extraction.voidprocessChunk(java.lang.String fourCC, byte[] payload)Perform whatever processing is necessary for the type of chunk with its payload.booleanshouldAcceptChunk(java.lang.String fourCC)Gets whether this handler is interested in the specific chunk type.booleanshouldAcceptList(java.lang.String fourCC)Gets whether this handler is interested in the specific list type.booleanshouldAcceptRiffIdentifier(java.lang.String identifier)Gets whether the specified RIFF identifier is of interest to this handler.
-
-
-
Field Detail
-
_directory
private final WavDirectory _directory
-
_currentList
private java.lang.String _currentList
-
-
Constructor Detail
-
WavRiffHandler
public WavRiffHandler(Metadata metadata)
-
-
Method Detail
-
shouldAcceptRiffIdentifier
public boolean shouldAcceptRiffIdentifier(java.lang.String identifier)
Description copied from interface:RiffHandlerGets whether the specified RIFF identifier is of interest to this handler. Returningfalsecauses processing to stop after reading only the first twelve bytes of data.- Specified by:
shouldAcceptRiffIdentifierin interfaceRiffHandler- Parameters:
identifier- The four character code identifying the type of RIFF data- Returns:
- true if processing should continue, otherwise false
-
shouldAcceptChunk
public boolean shouldAcceptChunk(java.lang.String fourCC)
Description copied from interface:RiffHandlerGets whether this handler is interested in the specific chunk type. Returnstrueif the data should be copied into an array and passed toRiffHandler.processChunk(String, byte[]), orfalseto avoid the copy and skip to the next chunk in the file, if any.- Specified by:
shouldAcceptChunkin interfaceRiffHandler- Parameters:
fourCC- the four character code of this chunk- Returns:
- true if
RiffHandler.processChunk(String, byte[])should be called, otherwise false
-
shouldAcceptList
public boolean shouldAcceptList(java.lang.String fourCC)
Description copied from interface:RiffHandlerGets whether this handler is interested in the specific list type. Returnstrueif the chunks should continue being processed, orfalseto avoid any unknown chunks within the list.- Specified by:
shouldAcceptListin interfaceRiffHandler- Parameters:
fourCC- the four character code of this chunk- Returns:
- true if
RiffHandler.processChunk(String, byte[])should be called, otherwise false
-
processChunk
public void processChunk(java.lang.String fourCC, byte[] payload)Description copied from interface:RiffHandlerPerform whatever processing is necessary for the type of chunk with its payload. This is only called if a previous call toRiffHandler.shouldAcceptChunk(String)with the samefourCCreturnedtrue.- Specified by:
processChunkin interfaceRiffHandler- Parameters:
fourCC- the four character code of the chunkpayload- they payload of the chunk as a byte array
-
addError
public void addError(java.lang.String message)
Description copied from interface:RiffHandlerRegisters an error message for consumption after extraction.- Specified by:
addErrorin interfaceRiffHandler- Parameters:
message- the error message
-
-