Class GenericSegment
java.lang.Object
org.apache.commons.imaging.common.BinaryFileParser
org.apache.commons.imaging.formats.jpeg.segments.Segment
org.apache.commons.imaging.formats.jpeg.segments.GenericSegment
- Direct Known Subclasses:
AppnSegment
,ComSegment
,UnknownSegment
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGenericSegment
(int marker, byte[] bytes) GenericSegment
(int marker, int markerLength, InputStream is) -
Method Summary
Modifier and TypeMethodDescriptionvoid
dump
(PrintWriter pw) void
dump
(PrintWriter pw, int start) byte[]
Returns a copy of the segment's contents, excluding the marker and length bytes at the beginning.protected byte
getSegmentData
(int offset) Returns a specific byte of the segment's contents, excluding the marker and length bytes at the beginning.getSegmentDataAsString
(String encoding) Convert the bytes to a StringMethods inherited from class org.apache.commons.imaging.formats.jpeg.segments.Segment
getDescription, getSegmentType, toString
Methods inherited from class org.apache.commons.imaging.common.BinaryFileParser
debugNumber, debugNumber, getByteOrder, setByteOrder
-
Field Details
-
segmentData
private final byte[] segmentData
-
-
Constructor Details
-
GenericSegment
- Throws:
IOException
-
GenericSegment
public GenericSegment(int marker, byte[] bytes)
-
-
Method Details
-
dump
-
dump
-
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:
-
getSegmentDataAsString
Convert the bytes to a String- Parameters:
encoding
- segment encoding- Returns:
- the encoded bytes
- Throws:
UnsupportedEncodingException
- if the encoding provided is not supported
-