TritonDataCenter / java-manta

Java Manta Client SDK
Mozilla Public License 2.0
16 stars 26 forks source link

Fixes #468 #570

Open indianwhocodes opened 4 years ago

indianwhocodes commented 4 years ago

Looking at our implementation of MantaSeekableByteChannel.read(ByteBuffer) it appears that we don't follow the API contract:

Interface documentation:

    /**
     * Reads a sequence of bytes from this channel into the given buffer.
     *
     * <p> Bytes are read starting at this channel's current position, and
     * then the position is updated with the number of bytes actually read.
     * Otherwise this method behaves exactly as specified in the {@link
     * ReadableByteChannel} interface.
     */

This method is not reading data into the supplied byte buffer at all. In the Java source code, many of the implementations that implement this method use the static method IOUtil.read. Within that implementation you can see that data is clearly being read into the ByteBuffer. Whereas in the MantaSeekableByteChannel implementation no data is being read into the ByteBuffer.