Search in sources :

Example 1 with ByteReaderStrategy

use of org.apache.hadoop.hdds.scm.storage.ByteReaderStrategy in project ozone by apache.

the class KeyInputStream method read.

/**
 * {@inheritDoc}
 */
@Override
public synchronized int read(byte[] b, int off, int len) throws IOException {
    ByteReaderStrategy strategy = new ByteArrayReader(b, off, len);
    int bufferLen = strategy.getTargetLength();
    if (bufferLen == 0) {
        return 0;
    }
    return readWithStrategy(strategy);
}
Also used : ByteReaderStrategy(org.apache.hadoop.hdds.scm.storage.ByteReaderStrategy) ByteArrayReader(org.apache.hadoop.hdds.scm.storage.ByteArrayReader)

Example 2 with ByteReaderStrategy

use of org.apache.hadoop.hdds.scm.storage.ByteReaderStrategy in project ozone by apache.

the class KeyInputStream method read.

@Override
public synchronized int read(ByteBuffer byteBuffer) throws IOException {
    ByteReaderStrategy strategy = new ByteBufferReader(byteBuffer);
    int bufferLen = strategy.getTargetLength();
    if (bufferLen == 0) {
        return 0;
    }
    return readWithStrategy(strategy);
}
Also used : ByteReaderStrategy(org.apache.hadoop.hdds.scm.storage.ByteReaderStrategy) ByteBufferReader(org.apache.hadoop.hdds.scm.storage.ByteBufferReader)

Aggregations

ByteReaderStrategy (org.apache.hadoop.hdds.scm.storage.ByteReaderStrategy)2 ByteArrayReader (org.apache.hadoop.hdds.scm.storage.ByteArrayReader)1 ByteBufferReader (org.apache.hadoop.hdds.scm.storage.ByteBufferReader)1