Module org.elasticsearch.server
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:
Closeable,AutoCloseable
Wraps a
StreamInput and associates it with a NamedWriteableRegistry-
Field Summary
Fields inherited from class org.elasticsearch.common.io.stream.FilterStreamInput
delegate -
Constructor Summary
ConstructorsConstructorDescriptionNamedWriteableAwareStreamInput(StreamInput delegate, NamedWriteableRegistry namedWriteableRegistry) -
Method Summary
Modifier and TypeMethodDescriptionGet the registry of named writeables if this stream has one,nullotherwise.<C extends NamedWriteable>
CreadNamedWriteable(Class<C> categoryClass) Reads aNamedWriteablefrom 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(Class<C> categoryClass, String name) Reads aNamedWriteablefrom the current stream with the given name.<T extends NamedWriteable>
List<T> readNamedWriteableCollectionAsList(Class<T> categoryClass) Reads a list ofNamedWriteables which was written usingStreamOutput.writeNamedWriteableCollection(java.util.Collection<? extends org.elasticsearch.common.io.stream.NamedWriteable>).Methods inherited from class org.elasticsearch.common.io.stream.FilterStreamInput
available, close, ensureCanReadBytes, getTransportVersion, read, read, readAllToReleasableBytesReference, readByte, readBytes, readInt, readLong, readReleasableBytesReference, readReleasableBytesReference, readShort, readSlicedBytesReference, readString, readVInt, readVLong, reset, setTransportVersion, supportReadAllToReleasableBytesReferenceMethods inherited from class org.elasticsearch.common.io.stream.StreamInput
doReadString, readArray, readArraySize, readBigInteger, readBoolean, readByteArray, readBytesRef, readBytesRef, readBytesReference, readBytesReference, readCollection, readCollectionAsImmutableList, readCollectionAsImmutableSet, readCollectionAsList, readCollectionAsSet, readDouble, readDoubleArray, readEnum, readEnumSet, readException, readFloat, readFloatArray, readFully, readGenericMap, readGenericValue, readGeoPoint, readImmutableMap, readImmutableMap, readImmutableOpenMap, readInstant, readIntArray, readLongArray, readMap, readMap, readMapOfLists, readMapValues, readMapValues, readOptional, readOptionalArray, readOptionalBoolean, readOptionalByteArray, readOptionalBytesReference, readOptionalCollectionAsList, readOptionalDouble, readOptionalEnum, readOptionalFloat, readOptionalFloatArray, readOptionalInstant, readOptionalInt, readOptionalLong, readOptionalNamedWriteable, readOptionalSecureString, readOptionalString, readOptionalStringArray, readOptionalStringCollectionAsList, readOptionalText, readOptionalTimeValue, readOptionalVInt, readOptionalVLong, readOptionalWriteable, readOptionalZoneId, readOrderedMap, readSecureString, readSlicedBytesReference, readStringArray, readStringCollectionAsImmutableList, readStringCollectionAsList, readText, readTimeValue, readVIntArray, readVIntSlow, readVLongArray, readVLongSlow, readZLong, readZoneId, throwEOF, throwOnBrokenVInt, throwOnBrokenVLong, throwOnNullRead, tryReadStringFromBytes, wrap, wrapMethods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, skip, skipNBytes, transferTo
-
Constructor Details
-
NamedWriteableAwareStreamInput
public NamedWriteableAwareStreamInput(StreamInput delegate, NamedWriteableRegistry namedWriteableRegistry)
-
-
Method Details
-
readNamedWriteable
Description copied from class:StreamInputReads aNamedWriteablefrom 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 throwsUnsupportedOperationExceptionas StreamInput doesn't hold a registry. UseFilterInputStreaminstead which wraps a stream and supports aNamedWriteableRegistrytoo.- Overrides:
readNamedWriteablein classStreamInput- Throws:
IOException
-
readNamedWriteableCollectionAsList
public <T extends NamedWriteable> List<T> readNamedWriteableCollectionAsList(Class<T> categoryClass) throws IOException Description copied from class:StreamInputReads a list ofNamedWriteables which was written usingStreamOutput.writeNamedWriteableCollection(java.util.Collection<? extends org.elasticsearch.common.io.stream.NamedWriteable>). If the returned list contains any entries it will be a (mutable)ArrayList. If it is empty it might be immutable.- Overrides:
readNamedWriteableCollectionAsListin classStreamInput- Throws:
IOException
-
readNamedWriteable
public <C extends NamedWriteable> C readNamedWriteable(Class<C> categoryClass, String name) throws IOException Description copied from class:StreamInputReads aNamedWriteablefrom 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 throwsUnsupportedOperationExceptionas StreamInput doesn't hold a registry. UseFilterInputStreaminstead which wraps a stream and supports aNamedWriteableRegistrytoo. PreferStreamInput.readNamedWriteable(Class)andStreamOutput.writeNamedWriteable(NamedWriteable)unless you have a compelling reason to use this method instead.- Overrides:
readNamedWriteablein classStreamInput- Throws:
IOException
-
namedWriteableRegistry
Description copied from class:StreamInputGet the registry of named writeables if this stream has one,nullotherwise.- Overrides:
namedWriteableRegistryin classFilterStreamInput
-