Class NamedWriteableAwareStreamInput
java.lang.Object
java.io.InputStream
org.elasticsearch.common.io.stream.StreamInput
org.elasticsearch.common.io.stream.FilterStreamInput
org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class NamedWriteableAwareStreamInput extends FilterStreamInput
Wraps a
StreamInput
and associates it with a NamedWriteableRegistry
-
Field Summary
-
Constructor Summary
Constructors Constructor Description NamedWriteableAwareStreamInput(StreamInput delegate, NamedWriteableRegistry namedWriteableRegistry)
-
Method Summary
Modifier and Type Method Description NamedWriteableRegistry
namedWriteableRegistry()
Get the registry of named writeables if this stream has one,null
otherwise.<C extends NamedWriteable>
CreadNamedWriteable(java.lang.Class<C> categoryClass)
Reads aNamedWriteable
from the current stream, by first reading its name and then looking for the corresponding entry in the registry by name, so that the proper object can be read and returned.<C extends NamedWriteable>
CreadNamedWriteable(java.lang.Class<C> categoryClass, java.lang.String name)
Reads aNamedWriteable
from the current stream with the given name.Methods inherited from class org.elasticsearch.common.io.stream.FilterStreamInput
available, close, ensureCanReadBytes, getVersion, read, readByte, readBytes, readInt, readLong, readShort, reset, setVersion
Methods inherited from class org.elasticsearch.common.io.stream.StreamInput
readArray, readBoolean, readByteArray, readBytesRef, readBytesRef, readBytesReference, readBytesReference, readDouble, readDoubleArray, readEnum, readEnumSet, readException, readFloat, readFloatArray, readFully, readGenericValue, readGeoPoint, readInstant, readIntArray, readList, readLongArray, readMap, readMap, readMapOfLists, readNamedWriteableList, readOptionalArray, readOptionalBoolean, readOptionalBytesReference, readOptionalDouble, readOptionalFloat, readOptionalInstant, readOptionalInt, readOptionalLong, readOptionalNamedWriteable, readOptionalSecureString, readOptionalString, readOptionalStringArray, readOptionalStringList, readOptionalText, readOptionalTimeValue, readOptionalTimeZone, readOptionalVInt, readOptionalVLong, readOptionalWriteable, readOptionalZoneId, readSecureString, readSet, readString, readStringArray, readStringList, readText, readTimeValue, readTimeZone, readVInt, readVIntArray, readVLong, readVLongArray, readZLong, readZoneId, wrap, wrap
-
Constructor Details
-
NamedWriteableAwareStreamInput
public NamedWriteableAwareStreamInput(StreamInput delegate, NamedWriteableRegistry namedWriteableRegistry)
-
-
Method Details
-
readNamedWriteable
public <C extends NamedWriteable> C readNamedWriteable(java.lang.Class<C> categoryClass) throws java.io.IOExceptionDescription copied from class:StreamInput
Reads aNamedWriteable
from the current stream, by first reading its name and then looking for the corresponding entry in the registry by name, so that the proper object can be read and returned. Default implementation throwsUnsupportedOperationException
as StreamInput doesn't hold a registry. UseFilterInputStream
instead which wraps a stream and supports aNamedWriteableRegistry
too.- Overrides:
readNamedWriteable
in classStreamInput
- Throws:
java.io.IOException
-
readNamedWriteable
public <C extends NamedWriteable> C readNamedWriteable(java.lang.Class<C> categoryClass, java.lang.String name) throws java.io.IOExceptionDescription copied from class:StreamInput
Reads aNamedWriteable
from the current stream with the given name. It is assumed that the caller obtained the name from other source, so it's not read from the stream. The name is used for looking for the corresponding entry in the registry by name, so that the proper object can be read and returned. Default implementation throwsUnsupportedOperationException
as StreamInput doesn't hold a registry. UseFilterInputStream
instead which wraps a stream and supports aNamedWriteableRegistry
too. PreferStreamInput.readNamedWriteable(Class)
andStreamOutput.writeNamedWriteable(NamedWriteable)
unless you have a compelling reason to use this method instead.- Overrides:
readNamedWriteable
in classStreamInput
- Throws:
java.io.IOException
-
namedWriteableRegistry
Description copied from class:StreamInput
Get the registry of named writeables if this stream has one,null
otherwise.- Overrides:
namedWriteableRegistry
in classFilterStreamInput
-