Class AbstractGenericSegment
- java.lang.Object
-
- org.apache.commons.imaging.common.BinaryFileParser
-
- org.apache.commons.imaging.formats.jpeg.segments.AbstractSegment
-
- org.apache.commons.imaging.formats.jpeg.segments.AbstractGenericSegment
-
- Direct Known Subclasses:
AppnSegment,ComSegment,UnknownSegment
public abstract class AbstractGenericSegment extends AbstractSegment
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]segmentData-
Fields inherited from class org.apache.commons.imaging.formats.jpeg.segments.AbstractSegment
length, marker
-
-
Constructor Summary
Constructors Constructor Description AbstractGenericSegment(int marker, byte[] bytes)AbstractGenericSegment(int marker, int markerLength, java.io.InputStream is)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddump(java.io.PrintWriter pw)voiddump(java.io.PrintWriter pw, int start)byte[]getSegmentData()Returns a copy of the segment's contents, excluding the marker and length bytes at the beginning.protected bytegetSegmentData(int offset)Returns a specific byte of the segment's contents, excluding the marker and length bytes at the beginning.java.lang.StringgetSegmentDataAsString(java.nio.charset.Charset encoding)Convert the bytes to a String-
Methods inherited from class org.apache.commons.imaging.formats.jpeg.segments.AbstractSegment
getDescription, getSegmentType, toString
-
Methods inherited from class org.apache.commons.imaging.common.BinaryFileParser
debugNumber, debugNumber, getByteOrder, setByteOrder
-
-
-
-
Method Detail
-
dump
public void dump(java.io.PrintWriter pw)
- Overrides:
dumpin classAbstractSegment
-
dump
public void dump(java.io.PrintWriter pw, int start)
-
getSegmentData
public byte[] getSegmentData()
Returns a copy of the segment's contents, excluding the marker and length bytes at the beginning.- Returns:
- the segment's contents
-
getSegmentData
protected byte getSegmentData(int offset)
Returns a specific byte of the segment's contents, excluding the marker and length bytes at the beginning.- Parameters:
offset- segment offset- Returns:
- the bye in the segment's contents
- See Also:
getSegmentData()
-
getSegmentDataAsString
public java.lang.String getSegmentDataAsString(java.nio.charset.Charset encoding)
Convert the bytes to a String- Parameters:
encoding- segment encoding- Returns:
- the encoded bytes
-
-