Class GenericSegment

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private byte[] segmentData  
      • Fields inherited from class org.apache.commons.imaging.formats.jpeg.segments.Segment

        length, marker
    • Constructor Summary

      Constructors 
      Constructor Description
      GenericSegment​(int marker, byte[] bytes)  
      GenericSegment​(int marker, int markerLength, java.io.InputStream is)  
    • Field Detail

      • segmentData

        private final byte[] segmentData
    • Constructor Detail

      • GenericSegment

        public GenericSegment​(int marker,
                              int markerLength,
                              java.io.InputStream is)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • GenericSegment

        public GenericSegment​(int marker,
                              byte[] bytes)
    • Method Detail

      • dump

        public void dump​(java.io.PrintWriter pw)
        Overrides:
        dump in class Segment
      • 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.lang.String encoding)
                                                throws java.io.UnsupportedEncodingException
        Convert the bytes to a String
        Parameters:
        encoding - segment encoding
        Returns:
        the encoded bytes
        Throws:
        java.io.UnsupportedEncodingException - if the encoding provided is not supported