Class AbstractSourceNativeInfo<K extends Comparable<K>,N>
java.lang.Object
io.aiven.commons.kafka.connector.source.AbstractSourceNativeInfo<K,N>
- Type Parameters:
K- the native key type.N- the native data type.
- All Implemented Interfaces:
Comparable<AbstractSourceNativeInfo<K,N>>
public abstract class AbstractSourceNativeInfo<K extends Comparable<K>,N>
extends Object
implements Comparable<AbstractSourceNativeInfo<K,N>>
An abstract implementation of NativeInfo handling for Source.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final NativeInfo<K,N> Package protected for NativeSourceData usestatic final longValue to be returned when the length of the stream is unknown. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractSourceNativeInfo(NativeInfo<K, N> nativeInfo) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(AbstractSourceNativeInfo<K, N> other) abstract longGets an estimate of the input stream length.abstract ContextCreates the context for the native info.protected abstract InputStreamRead the input data from the nativeInfo.org.apache.commons.io.function.IOSupplier<InputStream>Gets an InputStream supplier.Gets the native key.toString()
-
Field Details
-
UNKNOWN_STREAM_LENGTH
public static final long UNKNOWN_STREAM_LENGTHValue to be returned when the length of the stream is unknown.- See Also:
-
nativeInfo
Package protected for NativeSourceData use
-
-
Constructor Details
-
AbstractSourceNativeInfo
Constructor.- Parameters:
nativeInfo- the native info to process.
-
-
Method Details
-
nativeKey
Gets the native key.- Returns:
- the native key.
-
compareTo
- Specified by:
compareToin interfaceComparable<K extends Comparable<K>>
-
getContext
Creates the context for the native info.- Returns:
- the context for the native Info.
-
toString
-
getInputStreamSupplier
public org.apache.commons.io.function.IOSupplier<InputStream> getInputStreamSupplier() throws UnsupportedOperationExceptionGets an InputStream supplier.- Returns:
- the InputStream supplier.
- Throws:
UnsupportedOperationException- if the underlying NativeInfo does not support input streams.
-
getInputStream
Read the input data from the nativeInfo.- Returns:
- the input stream
- Throws:
IOException- on IO error.UnsupportedOperationException- if the underlying NativeInfo does not support input streams.
-
estimateInputStreamLength
Gets an estimate of the input stream length.- Returns:
- an estimate of the input stream length, or
UNKNOWN_STREAM_LENGTHif not known. - Throws:
UnsupportedOperationException- if the underlying NativeInfo does not support input streams.
-