in hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/impl/FSDataInputStreamShimImpl.java [103:131]
public FSDataInputStreamShimImpl(
final FSDataInputStream instance) {
super(FSDataInputStream.class, instance);
byteBufferPositionedRead = loadInvocation(getClazz(), READ,
Integer.class,
Long.class, ByteBuffer.class);
boolean bbrb = instance.hasCapability(PREADBYTEBUFFER)
&& byteBufferPositionedRead.available();
if (bbrb) {
byteBufferPositionedReadFully = loadInvocation(getClazz(),
READ_FULLY, Void.class, Long.class, ByteBuffer.class);
isByteBufferPositionedReadAvailable = new AtomicBoolean(true);
} else {
byteBufferPositionedReadFully = unavailable(READ_FULLY);
isByteBufferPositionedReadAvailable = new AtomicBoolean(false);
}
// declare ByteBufferReadable available if the inner stream supports it.
// if an attempt to use it fails, it will downgrade
isByteBufferReadableAvailable = new AtomicBoolean(
instance.getWrappedStream() instanceof ByteBufferReadable);
if (FILE_RANGE_BRIDGE.bridgeAvailable()) {
readVectored = loadInvocation(getClazz(), READ_VECTORED,
Void.class, List.class, Function.class);
} else {
readVectored = unavailable(READ_VECTORED);
}
}