Class AbstractWebPChunk
- java.lang.Object
-
- org.apache.commons.imaging.common.BinaryFileParser
-
- org.apache.commons.imaging.formats.webp.chunks.AbstractWebPChunk
-
- Direct Known Subclasses:
WebPChunkAlph,WebPChunkAnim,WebPChunkAnmf,WebPChunkExif,WebPChunkIccp,WebPChunkVp8,WebPChunkVp8l,WebPChunkVp8x,WebPChunkXml,WebPChunkXyzw
public abstract class AbstractWebPChunk extends BinaryFileParser
A WebP image is composed of several chunks. This is the base class for the chunks, used by the parser.- Since:
- 1.0.0-alpha4
- See Also:
- WebP Container Specification
-
-
Constructor Summary
Constructors Modifier Constructor Description AbstractWebPChunk(int type, int size, byte[] bytes)Create a new WebP chunk.privateAbstractWebPChunk(int type, int size, byte[] bytes, boolean ignored)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static booleancheckArgs(int size, byte[] bytes)voiddump(java.io.PrintWriter pw, int offset)Print the chunk to the given stream.byte[]getBytes()intgetChunkSize()intgetPayloadSize()intgetType()java.lang.StringgetTypeDescription()-
Methods inherited from class org.apache.commons.imaging.common.BinaryFileParser
debugNumber, debugNumber, getByteOrder, setByteOrder
-
-
-
-
Constructor Detail
-
AbstractWebPChunk
public AbstractWebPChunk(int type, int size, byte[] bytes) throws ImagingExceptionCreate a new WebP chunk.- Parameters:
type- chunk type.size- chunk size.bytes- chunk data.- Throws:
ImagingException- if the chunk data and the size provided do not match.
-
AbstractWebPChunk
private AbstractWebPChunk(int type, int size, byte[] bytes, boolean ignored)
-
-
Method Detail
-
checkArgs
private static boolean checkArgs(int size, byte[] bytes) throws ImagingException- Throws:
ImagingException
-
dump
public void dump(java.io.PrintWriter pw, int offset) throws ImagingException, java.io.IOExceptionPrint the chunk to the given stream.- Parameters:
pw- a stream to write to.offset- chunk offset.- Throws:
ImagingException- if the image is invalid.java.io.IOException- if it fails to write to the given stream.
-
getBytes
public byte[] getBytes()
- Returns:
- a copy of the chunk data as bytes.
-
getChunkSize
public int getChunkSize()
- Returns:
- the chunk size.
-
getPayloadSize
public int getPayloadSize()
- Returns:
- the payload size.
-
getType
public int getType()
- Returns:
- the chunk type.
-
getTypeDescription
public java.lang.String getTypeDescription()
- Returns:
- the description of the chunk type.
-
-