Class BytesStreamInput
- All Implemented Interfaces:
Closeable,AutoCloseable
StreamInput version of Lucene's ByteArrayDataInput
This is used as a replacement of Lucene ByteArrayDataInput for abstracting byte order changes
in Lucene's API
Attribution given to apache lucene project under ALv2: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Opensearch.internal:
-
Constructor Summary
ConstructorsConstructorDescriptionBytesStreamInput(byte[] bytes) BytesStreamInput(byte[] bytes, int offset, int len) -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()Closes the stream to further operations.protected voidensureCanReadBytes(int length) This method throws anEOFExceptionif the given number of bytes can not be read from the this stream.booleaneof()intintread()bytereadByte()Reads and returns a single byte.voidreadBytes(byte[] b, int offset, int len) Reads a specified number of bytes into an array at the specified offset.intreadInt()Reads four bytes and returns an int.longreadLong()Reads eight bytes and returns a long.shortvoidreset(byte[] bytes) voidreset(byte[] bytes, int offset, int len) voidsetPosition(int pos) voidskipBytes(long count) Methods inherited from class org.opensearch.core.common.io.stream.StreamInput
getVersion, namedWriteableRegistry, readArray, readBigInteger, readBoolean, readBuild, readByteArray, readBytesRef, readBytesRef, readBytesReference, readBytesReference, readDouble, readDoubleArray, readEnum, readEnumSet, readException, readFloat, readFloatArray, readFully, readGenericValue, readInstant, readIntArray, readList, readLongArray, readMap, readMap, readMapOfLists, readMediaType, readNamedWriteable, readNamedWriteable, readNamedWriteableList, readOptionalArray, readOptionalBoolean, readOptionalBytesReference, readOptionalDouble, readOptionalFloat, readOptionalInstant, readOptionalInt, readOptionalLong, readOptionalNamedWriteable, readOptionalSecureString, readOptionalString, readOptionalStringArray, readOptionalStringList, readOptionalText, readOptionalTimeValue, readOptionalVInt, readOptionalVLong, readOptionalWriteable, readOptionalZoneId, readOrderedMap, readOrderedMap, readSecureString, readSemverRange, readSet, readString, readStringArray, readStringList, readText, readTimeValue, readVersion, readVInt, readVIntArray, readVLong, readVLongArray, readZLong, readZoneId, setVersion, wrap, wrapMethods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
Constructor Details
-
BytesStreamInput
public BytesStreamInput(byte[] bytes) -
BytesStreamInput
public BytesStreamInput(byte[] bytes, int offset, int len) -
BytesStreamInput
public BytesStreamInput()
-
-
Method Details
-
reset
public void reset(byte[] bytes) -
getPosition
public int getPosition() -
setPosition
public void setPosition(int pos) -
reset
public void reset(byte[] bytes, int offset, int len) -
eof
public boolean eof() -
skipBytes
public void skipBytes(long count) -
readByte
Description copied from class:StreamInputReads and returns a single byte.- Specified by:
readBytein classStreamInput- Throws:
EOFException
-
readBytes
Description copied from class:StreamInputReads a specified number of bytes into an array at the specified offset.- Specified by:
readBytesin classStreamInput- Parameters:
b- the array to read bytes intooffset- the offset in the array to start storing byteslen- the number of bytes to read- Throws:
EOFException
-
close
public void close()Description copied from class:StreamInputCloses the stream to further operations.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classStreamInput
-
available
public int available()- Specified by:
availablein classStreamInput
-
ensureCanReadBytes
Description copied from class:StreamInputThis method throws anEOFExceptionif the given number of bytes can not be read from the this stream. This method might be a no-op depending on the underlying implementation if the information of the remaining bytes is not present.- Specified by:
ensureCanReadBytesin classStreamInput- Throws:
EOFException
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
readShort
- Overrides:
readShortin classStreamInput- Throws:
IOException
-
readInt
Description copied from class:StreamInputReads four bytes and returns an int.- Overrides:
readIntin classStreamInput- Throws:
IOException
-
readLong
Description copied from class:StreamInputReads eight bytes and returns a long.- Overrides:
readLongin classStreamInput- Throws:
IOException
-