Example usage for org.apache.hadoop.io InputBuffer reset

List of usage examples for org.apache.hadoop.io InputBuffer reset

Introduction

In this page you can find the example usage for org.apache.hadoop.io InputBuffer reset.

Prototype

public void reset(byte[] input, int start, int length) 

Source Link

Document

Resets the data that the buffer reads.

Usage

From source file:com.asakusafw.runtime.value.StringOptionUtil.java

License:Apache License

/**
 * Returns a {@link Reader} to read the text contents in the {@link StringOption}.
 * @param option the target {@link StringOption}
 * @return the created reader/*from  w w  w.  j  av  a  2s  . c  om*/
 * @throws NullPointerException if the {@link StringOption} is/represents {@code null}
 */
public static Reader asReader(StringOption option) {
    Text text = option.get();
    InputBuffer buffer = new InputBuffer();
    buffer.reset(text.getBytes(), 0, text.getLength());
    return new InputStreamReader(buffer, ENCODING);
}