Class StringDecoder

  • All Implemented Interfaces:
    CharDecoder

    public class StringDecoder
    extends java.lang.Object
    implements CharDecoder
    This class reads a string.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int length
      The number of chars in the string.
      protected int next
      The next char index.
      protected java.lang.String string
      The string which contains the decoded characters.
    • Constructor Summary

      Constructors 
      Constructor Description
      StringDecoder​(java.lang.String s)
      Creates a new StringDecoder.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dispose()
      Disposes the associated resources.
      int readChar()
      Reads the next character.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • string

        protected java.lang.String string
        The string which contains the decoded characters.
      • length

        protected int length
        The number of chars in the string.
      • next

        protected int next
        The next char index.
    • Constructor Detail

      • StringDecoder

        public StringDecoder​(java.lang.String s)
        Creates a new StringDecoder.
    • Method Detail

      • readChar

        public int readChar()
                     throws java.io.IOException
        Reads the next character.
        Specified by:
        readChar in interface CharDecoder
        Returns:
        a character or END_OF_STREAM.
        Throws:
        java.io.IOException
      • dispose

        public void dispose()
                     throws java.io.IOException
        Disposes the associated resources.
        Specified by:
        dispose in interface CharDecoder
        Throws:
        java.io.IOException