Package io.github.netvl.ecoji
Class Ecoji.Decoder.Target
- java.lang.Object
-
- io.github.netvl.ecoji.Ecoji.Decoder.Target
-
- Enclosing class:
- Ecoji.Decoder
public static class Ecoji.Decoder.Target extends java.lang.ObjectAn intermediate class, needed to implement the builder-like DSL for decoding.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intwriteTo(java.io.OutputStream outputStream)Writes the original representation of the base-1024 encoded data contained in the previously specified source to the providedOutputStream.byte[]writeToBytes()Returns the original representation of the base-1024 encoded data contained in the previously specified source as a byte array.java.lang.StringwriteToString()Returns the original representation of the base-1024 encoded data contained in the previously specified source as aString, decoding it using the UTF-8 encoding.java.lang.StringwriteToString(java.nio.charset.Charset charset)Returns the original representation of the base-1024 encoded data contained in the previously specified source as aString, decoding it using the providedCharset.
-
-
-
Method Detail
-
writeTo
public int writeTo(java.io.OutputStream outputStream) throws java.io.IOExceptionWrites the original representation of the base-1024 encoded data contained in the previously specified source to the providedOutputStream.The provided
OutputStreamwill not be closed when the operation finishes.- Parameters:
outputStream- AnOutputStreamwhich 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.IOExceptionReturns 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.IOExceptionReturns the original representation of the base-1024 encoded data contained in the previously specified source as aString, decoding it using the providedCharset.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
Stringdecoded using the providedCharsetfrom 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.IOExceptionReturns the original representation of the base-1024 encoded data contained in the previously specified source as aString, 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
Stringdecoded 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.
-
-