Interface ByteArrayDecoder<T>
-
- Type Parameters:
T- The decoded item data type
- All Known Subinterfaces:
ByteArrayCodec<T>
- All Known Implementing Classes:
DelegatingByteArrayCodec
public interface ByteArrayDecoder<T>A functional interface for decoders working on byte arrays representing single items. In contract toItemDecoder, this decoder should always be stateless, and is suitable for cases where the data to decode is already in an array, whose bytes encode a single item to decode.- Author:
- Eyal Schneider
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Tdecode(byte[] bytes)default ItemDecoder<T>newFixedRecSizeDecoder(InputStream is, FileReadOptions readOptions, int recSize)Returns an efficientItemDecoderbased on this byte array decoder, assuming a fixed record size.
-
-
-
Method Detail
-
decode
T decode(byte[] bytes) throws ValidationPipeException
- Parameters:
bytes- The byte representation of an item to decode- Returns:
- The decoded item
- Throws:
ValidationPipeException- In case that the data for decoding is illegal
-
newFixedRecSizeDecoder
default ItemDecoder<T> newFixedRecSizeDecoder(InputStream is, FileReadOptions readOptions, int recSize) throws IOException
Returns an efficientItemDecoderbased on this byte array decoder, assuming a fixed record size.- Parameters:
is- The input stream to build the decoder forreadOptions- The read options defining how the input stream should be manipulatedrecSize- The fixed record size- Returns:
- A new item decoder based on the given input stream, and using this byte array decoder under the hood
- Throws:
IOException- In case of IO error while preparing to read from the input stream
-
-