Package ch.raffael.meldioc.library.codec
Class AbstractCharDataObjectCodec<T>
- java.lang.Object
-
- ch.raffael.meldioc.library.codec.AbstractCharDataObjectCodec<T>
-
- All Implemented Interfaces:
ObjectCodec<T>,ObjectDecoder<T>,ObjectEncoder<T>
- Direct Known Subclasses:
GsonObjectCodec
public abstract class AbstractCharDataObjectCodec<T> extends java.lang.Object implements ObjectCodec<T>
Abstract object codec for character data like JSON or XML.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractCharDataObjectCodec.Configuration<SELF,T,S extends java.util.function.Consumer<? super T>>TODO JavaDoc
-
Field Summary
Fields Modifier and Type Field Description static ch.raffael.meldioc.library.codec.ContentTypeCONTENT_TYPEstatic intDEFAULT_BUFFER_SIZEstatic intMIN_BUFFER_SIZEstatic io.vavr.control.Option<ch.raffael.meldioc.library.codec.ContentType>SOME_CONTENT_TYPE
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractCharDataObjectCodec()protectedAbstractCharDataObjectCodec(int bufferSize)protectedAbstractCharDataObjectCodec(int bufferSize, io.vavr.control.Option<java.nio.charset.Charset> charset)protectedAbstractCharDataObjectCodec(io.vavr.control.Option<java.nio.charset.Charset> charset)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract ch.raffael.meldioc.library.codec.ContentTypebaseContentType()Tdecode(byte[] data)Tdecode(java.io.InputStream stream)protected abstract Tdecode(java.io.Reader source)protected java.nio.charset.CharsetdefaultCharset()io.vavr.Tuple2<byte[],ch.raffael.meldioc.library.codec.ContentType>encode(T value)ch.raffael.meldioc.library.codec.ContentTypeencode(T value, java.io.OutputStream target)protected abstract voidencode(T value, java.io.Writer target)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ch.raffael.meldioc.library.codec.ObjectDecoder
isInvalidInput
-
-
-
-
Field Detail
-
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE
- See Also:
- Constant Field Values
-
MIN_BUFFER_SIZE
public static final int MIN_BUFFER_SIZE
- See Also:
- Constant Field Values
-
CONTENT_TYPE
public static final ch.raffael.meldioc.library.codec.ContentType CONTENT_TYPE
-
SOME_CONTENT_TYPE
public static final io.vavr.control.Option<ch.raffael.meldioc.library.codec.ContentType> SOME_CONTENT_TYPE
-
-
Constructor Detail
-
AbstractCharDataObjectCodec
protected AbstractCharDataObjectCodec()
-
AbstractCharDataObjectCodec
protected AbstractCharDataObjectCodec(io.vavr.control.Option<java.nio.charset.Charset> charset)
-
AbstractCharDataObjectCodec
protected AbstractCharDataObjectCodec(int bufferSize)
-
AbstractCharDataObjectCodec
protected AbstractCharDataObjectCodec(int bufferSize, io.vavr.control.Option<java.nio.charset.Charset> charset)
-
-
Method Detail
-
decode
public T decode(java.io.InputStream stream) throws java.io.IOException
- Specified by:
decodein interfaceObjectDecoder<T>- Throws:
java.io.IOException
-
decode
public T decode(byte[] data) throws java.io.IOException
- Specified by:
decodein interfaceObjectDecoder<T>- Throws:
java.io.IOException
-
encode
public ch.raffael.meldioc.library.codec.ContentType encode(T value, java.io.OutputStream target) throws java.io.IOException
- Specified by:
encodein interfaceObjectEncoder<T>- Throws:
java.io.IOException
-
encode
public io.vavr.Tuple2<byte[],ch.raffael.meldioc.library.codec.ContentType> encode(T value) throws java.io.IOException
- Specified by:
encodein interfaceObjectEncoder<T>- Throws:
java.io.IOException
-
decode
protected abstract T decode(java.io.Reader source) throws java.io.IOException
- Throws:
java.io.IOException
-
encode
protected abstract void encode(T value, java.io.Writer target) throws java.io.IOException
- Throws:
java.io.IOException
-
defaultCharset
protected java.nio.charset.Charset defaultCharset()
-
baseContentType
protected abstract ch.raffael.meldioc.library.codec.ContentType baseContentType()
-
-