Class IA5StringCodec<T>

    • Method Detail

      • getStandardCodec

        public static <T> IA5StringCodec<T> getStandardCodec()
        Gets the standard IA5StringCodec.
        Returns:
        IA5StringCodec
      • getLaxDecoder

        public IA5StringCodec<T> getLaxDecoder()
        Gets an IA5StringCodec like the standard one except that decoding invalid characters produces ? characters instead of throwing an exception. The lax decoder of a lax decoder is itself (idempotent).
        Specified by:
        getLaxDecoder in interface StringCodec<T>
        Returns:
        StringCodec
      • encodeString

        public byte[] encodeString​(String string,
                                   StringIndicators indicators)
        Encodes a String of characters to a byte array, accepting only ASCII/ISO646-US characters, and encoding each character according to that character set. Sets an indicator to assist decoding by other StringCodecs.
        Specified by:
        encodeString in interface StringCodec<T>
        Parameters:
        string - the String to be encoded to a byte array
        indicators - the StringIndicators object in which to set the indicators
        Returns:
        the encoded byte array
        Throws:
        UnsupportedDigitException - if a non-ASCII character is found
      • encodeString

        public byte[] encodeString​(String string)
        Encodes a String of characters to a byte array, accepting only ASCII/ISO646-US characters, and encoding each character according to that character set.
        Specified by:
        encodeString in interface StringCodec<T>
        Parameters:
        string - the String to be encoded to a byte array
        Returns:
        the encoded byte array
        Throws:
        UnsupportedDigitException - if a non-ASCII character is found
      • decodeString

        public String decodeString​(byte[] encoded,
                                   StringIndicators indicators)
        Decodes a String of characters from a byte array, taking all values (regardless of given odd), expecting only values [0,127], and decoding them to ASCII/ISO646-US characters. If a value outside the range [0,127] is found, the standard decoder throws UnsupportedDigitException, while the lax decoder decodes a ? character.
        Specified by:
        decodeString in interface StringCodec<T>
        Parameters:
        encoded - the byte array to be decoded to a String
        indicators - indicator values needed for decoding (ignored)
        Returns:
        the decoded String
        Throws:
        UnsupportedDigitException - if any encoded content is not in range [0,127]
      • decodeString

        public String decodeString​(byte[] encoded)
        Decodes a String of characters from a byte array, taking all values (regardless of given odd), expecting only values [0,127], and decoding them to ASCII/ISO646-US characters. If a value outside the range [0,127] is found, the standard decoder throws UnsupportedDigitException, while the lax decoder decodes a ? character.
        Specified by:
        decodeString in interface StringCodec<T>
        Parameters:
        encoded - the byte array to be decoded to a String
        Returns:
        the decoded String
        Throws:
        UnsupportedDigitException - if any encoded content is not in range [0,127]