Class Ecoji.Decoder.Target

  • Enclosing class:
    Ecoji.Decoder

    public static class Ecoji.Decoder.Target
    extends java.lang.Object
    An intermediate class, needed to implement the builder-like DSL for decoding.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int writeTo​(java.io.OutputStream outputStream)
      Writes the original representation of the base-1024 encoded data contained in the previously specified source to the provided OutputStream.
      byte[] writeToBytes()
      Returns the original representation of the base-1024 encoded data contained in the previously specified source as a byte array.
      java.lang.String writeToString()
      Returns the original representation of the base-1024 encoded data contained in the previously specified source as a String, decoding it using the UTF-8 encoding.
      java.lang.String writeToString​(java.nio.charset.Charset charset)
      Returns the original representation of the base-1024 encoded data contained in the previously specified source as a String, decoding it using the provided Charset.
      • Methods inherited from class java.lang.Object

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

      • writeTo

        public int writeTo​(java.io.OutputStream outputStream)
                    throws java.io.IOException
        Writes the original representation of the base-1024 encoded data contained in the previously specified source to the provided OutputStream.

        The provided OutputStream will not be closed when the operation finishes.

        Parameters:
        outputStream - An OutputStream which accept the original representation of the base-1024 encoded data.
        Returns:
        A number of bytes written to the provided OutputStream.
        Throws:
        java.io.IOException - If an error has happened during a read or a write operation, or if the input cannot be decoded properly.
      • writeToBytes

        public byte[] writeToBytes()
                            throws java.io.IOException
        Returns the original representation of the base-1024 encoded data contained in the previously specified source as a byte array.
        Returns:
        An array of bytes which contain the original representation of the base-1024 encoded data contained in the provided source.
        Throws:
        java.io.IOException - If an error has happened during a read or a write operation, or if the input cannot be decoded properly.
      • writeToString

        public java.lang.String writeToString​(java.nio.charset.Charset charset)
                                       throws java.io.IOException
        Returns the original representation of the base-1024 encoded data contained in the previously specified source as a String, decoding it using the provided Charset.

        If the decoded bytes do not form a valid string in the specified encoding, then according to the contract of the String(byte[], Charset) constructor, invalid characters will be replaced with the replacement characters for this encoding.

        Parameters:
        charset - A character encoding which is used to decode the string.
        Returns:
        A String decoded using the provided Charset from the original representation of the base-1024 encoded data contained in the provided source.
        Throws:
        java.io.IOException - If an error has happened during a read or a write operation, or if the input cannot be decoded properly.
      • writeToString

        public java.lang.String writeToString()
                                       throws java.io.IOException
        Returns the original representation of the base-1024 encoded data contained in the previously specified source as a String, decoding it using the UTF-8 encoding.

        If the decoded bytes do not form a valid UTF-8 string, then according to the contract of the String(byte[], Charset) constructor, invalid characters will be replaced with the UTF-8 replacement characters.

        Returns:
        A String decoded using the UTF-8 encoding from the original representation of the base-1024 encoded data contained in the provided source.
        Throws:
        java.io.IOException - If an error has happened during a read or a write operation, or if the input cannot be decoded properly.