Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public abstract class AbstractS3Reader implements PhysicalReader
* The implementations of most methods in this class are from its subclass PhysicalS3Reader.
*/

protected boolean enableAsync = false;
protected boolean useAsyncClient = false;
protected boolean enableAsync;
protected boolean useAsyncClient;
protected static final ExecutorService clientService;

static
Expand Down Expand Up @@ -125,7 +125,7 @@ protected String toRange(long start, int length)
}

@Override
public long getFileLength() throws IOException
public long getFileLength()
{
return length;
}
Expand Down Expand Up @@ -159,7 +159,8 @@ public ByteBuffer readFully(int len) throws IOException
this.numRequests++;
this.position += len;
return response.asByteBuffer();
} catch (Exception e)
}
catch (Exception e)
{
throw new IOException("Failed to read object.", e);
}
Expand All @@ -175,8 +176,16 @@ public void readFully(byte[] buffer) throws IOException
public void readFully(byte[] buffer, int off, int len) throws IOException
{
ByteBuffer byteBuffer = readFully(len);
// This is more efficient than byteBuffer.put(buffer, off, len).
System.arraycopy(byteBuffer.array(), byteBuffer.arrayOffset() + byteBuffer.position(), buffer, off, len);
if (byteBuffer.hasArray())
{
// This is more efficient than byteBuffer.get(buffer, off, len).
System.arraycopy(byteBuffer.array(), byteBuffer.arrayOffset() + byteBuffer.position(),
buffer, off, len);
}
else
{
byteBuffer.get(buffer, off, len);
}
}

/**
Expand Down