Class DelegatingCodecFactory<T>
- java.lang.Object
-
- org.pipecraft.pipes.serialization.DelegatingCodecFactory<T>
-
- Type Parameters:
T- The encoded/decoded items' data type
- All Implemented Interfaces:
CodecFactory<T>,DecoderFactory<T>,EncoderFactory<T>
- Direct Known Subclasses:
TxtCodecFactory
public class DelegatingCodecFactory<T> extends Object implements CodecFactory<T>
Wraps a given encoder and decoder factories, and delegates encoding/decoding creation requests to them.- Author:
- Eyal Schneider
-
-
Constructor Summary
Constructors Constructor Description DelegatingCodecFactory(EncoderFactory<T> encoder, DecoderFactory<T> decoder)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ItemDecoder<T>newDecoder(InputStream is, FileReadOptions readOptions)ItemEncoder<T>newEncoder(OutputStream os, FileWriteOptions writeOptions)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pipecraft.pipes.serialization.CodecFactory
getByteArrayCodec
-
Methods inherited from interface org.pipecraft.pipes.serialization.DecoderFactory
newByteArrayDecoder, newDecoder
-
Methods inherited from interface org.pipecraft.pipes.serialization.EncoderFactory
newByteArrayEncoder, newEncoder
-
-
-
-
Constructor Detail
-
DelegatingCodecFactory
public DelegatingCodecFactory(EncoderFactory<T> encoder, DecoderFactory<T> decoder)
Constructor- Parameters:
encoder- The encoder factorydecoder- The decoder factory
-
-
Method Detail
-
newDecoder
public ItemDecoder<T> newDecoder(InputStream is, FileReadOptions readOptions) throws IOException
- Specified by:
newDecoderin interfaceDecoderFactory<T>- Parameters:
is- The input stream the decoder should be bound to. Not expected to be buffered. Buffering is added by the decoder.readOptions- defines how the input stream should be handled- Returns:
- The new decoder
- Throws:
IOException- In case of an IO error while preparing to read from the input stream
-
newEncoder
public ItemEncoder<T> newEncoder(OutputStream os, FileWriteOptions writeOptions) throws IOException
- Specified by:
newEncoderin interfaceEncoderFactory<T>- Parameters:
os- The output stream the encoder should be bound to. Not expected to be buffered. The encoder handles buffering.writeOptions- The way the output stream should be handled- Returns:
- The new encoder
- Throws:
IOException- In case of an IO error while preparing to write to the output stream
-
-