Home | History | Annotate | Download | only in impl
      1 // Copyright 2014 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 package org.chromium.mojo.system.impl;
      6 
      7 import org.chromium.mojo.system.DataPipe.ConsumerHandle;
      8 import org.chromium.mojo.system.DataPipe.ReadFlags;
      9 import org.chromium.mojo.system.ResultAnd;
     10 
     11 import java.nio.ByteBuffer;
     12 
     13 /**
     14  * Implementation of {@link ConsumerHandle}.
     15  */
     16 class DataPipeConsumerHandleImpl extends HandleBase implements ConsumerHandle {
     17 
     18     /**
     19      * @see HandleBase#HandleBase(CoreImpl, int)
     20      */
     21     DataPipeConsumerHandleImpl(CoreImpl core, int mojoHandle) {
     22         super(core, mojoHandle);
     23     }
     24 
     25     /**
     26      * @see HandleBase#HandleBase(HandleBase)
     27      */
     28     DataPipeConsumerHandleImpl(HandleBase other) {
     29         super(other);
     30     }
     31 
     32     /**
     33      * @see org.chromium.mojo.system.Handle#pass()
     34      */
     35     @Override
     36     public ConsumerHandle pass() {
     37         return new DataPipeConsumerHandleImpl(this);
     38     }
     39 
     40     /**
     41      * @see ConsumerHandle#discardData(int, ReadFlags)
     42      */
     43     @Override
     44     public int discardData(int numBytes, ReadFlags flags) {
     45         return mCore.discardData(this, numBytes, flags);
     46     }
     47 
     48     /**
     49      * @see ConsumerHandle#readData(ByteBuffer, ReadFlags)
     50      */
     51     @Override
     52     public ResultAnd<Integer> readData(ByteBuffer elements, ReadFlags flags) {
     53         return mCore.readData(this, elements, flags);
     54     }
     55 
     56     /**
     57      * @see ConsumerHandle#beginReadData(int, ReadFlags)
     58      */
     59     @Override
     60     public ByteBuffer beginReadData(int numBytes, ReadFlags flags) {
     61         return mCore.beginReadData(this, numBytes, flags);
     62     }
     63 
     64     /**
     65      * @see ConsumerHandle#endReadData(int)
     66      */
     67     @Override
     68     public void endReadData(int numBytesRead) {
     69         mCore.endReadData(this, numBytesRead);
     70     }
     71 
     72 }
     73