Class GenericSegment

Direct Known Subclasses:
AppnSegment, ComSegment, UnknownSegment

public abstract class GenericSegment extends Segment
  • Field Details

    • segmentData

      private final byte[] segmentData
  • Constructor Details

    • GenericSegment

      public GenericSegment(int marker, int markerLength, InputStream is) throws IOException
      Throws:
      IOException
    • GenericSegment

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

    • dump

      public void dump(PrintWriter pw)
      Overrides:
      dump in class Segment
    • dump

      public void dump(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:
    • getSegmentDataAsString

      public String getSegmentDataAsString(String encoding) throws UnsupportedEncodingException
      Convert the bytes to a String
      Parameters:
      encoding - segment encoding
      Returns:
      the encoded bytes
      Throws:
      UnsupportedEncodingException - if the encoding provided is not supported