Package org.apache.hadoop.fs.impl
Class FileRangeImpl
java.lang.Object
org.apache.hadoop.fs.impl.FileRangeImpl
- All Implemented Interfaces:
FileRange
- Direct Known Subclasses:
CombinedFileRange
A range of bytes from a file with an optional buffer to read those bytes
for zero copy. This shouldn't be created directly via constructor rather
factory defined in
FileRange#createFileRange should be used.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetData()Get the future data for this range.intGet the length of the range.longGet the starting offset of the range.Get any reference passed in to the file range constructor.voidsetData(CompletableFuture<ByteBuffer> pReader) Set a future for this range's data.voidsetLength(int length) voidsetOffset(long offset) toString()
-
Constructor Details
-
FileRangeImpl
Create.- Parameters:
offset- offset in filelength- length of data to read.reference- nullable reference to store in the range.
-
-
Method Details
-
toString
-
getOffset
public long getOffset()Description copied from interface:FileRangeGet the starting offset of the range. -
getLength
public int getLength()Description copied from interface:FileRangeGet the length of the range. -
setOffset
public void setOffset(long offset) -
setLength
public void setLength(int length) -
setData
Description copied from interface:FileRangeSet a future for this range's data. This method is called byPositionedReadable.readVectored(java.util.List<? extends org.apache.hadoop.fs.FileRange>, java.util.function.IntFunction<java.nio.ByteBuffer>)to store the data for the user to pick up later viaFileRange.getData(). -
getData
Description copied from interface:FileRangeGet the future data for this range.- Specified by:
getDatain interfaceFileRange- Returns:
- the future for the
ByteBufferthat contains the data
-
getReference
Description copied from interface:FileRangeGet any reference passed in to the file range constructor. This is not used by any implementation code; it is to help bind this API to libraries retrieving multiple stripes of data in parallel.- Specified by:
getReferencein interfaceFileRange- Returns:
- a reference or null.
-