bharatviswa504 commented on a change in pull request #345: HDDS-2703. 
OzoneFSInputStream to support ByteBufferReadable
URL: https://github.com/apache/hadoop-ozone/pull/345#discussion_r357880290
 
 

 ##########
 File path: 
hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/OzoneFSInputStream.java
 ##########
 @@ -76,4 +81,39 @@ public boolean seekToNewSource(long targetPos) throws 
IOException {
   public int available() throws IOException {
     return inputStream.available();
   }
+
+  /**
+   * @param buf the ByteBuffer to receive the results of the read operation.
+   * @return the number of bytes read, possibly zero, or -1 if
+   *         reach end-of-stream
+   * @throws IOException if there is some error performing the read
+   */
+  @Override
+  public int read(ByteBuffer buf) throws IOException {
+
+    int bufInitPos = buf.position();
+    int readLen = Math.min(buf.remaining(), inputStream.available());
+
+    byte[] readData = new byte[readLen];
+    int bytesRead = inputStream.read(readData, bufInitPos, readLen);
+    buf.put(readData);
+
+    return bytesRead;
+  }
+
+  /**
+   * Query the stream for a specific capability.
+   *
+   * @param capability string to query the stream support for.
+   * @return True if the stream supports capability.
+   */
+  @Override
+  public boolean hasCapability(String capability) {
+    switch (StringUtils.toLowerCase(capability)) {
+    case "in:readbytebuffer":
 
 Review comment:
   If it is something we want to support, can we address this in new Jira.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to