Search in sources :

Example 1 with HadoopDataOutStream

use of org.apache.ignite.internal.processors.hadoop.shuffle.streams.HadoopDataOutStream in project ignite by apache.

the class HadoopDataStreamSelfTest method testStreams.

/**
     * @throws IOException If failed.
     */
public void testStreams() throws IOException {
    GridUnsafeMemory mem = new GridUnsafeMemory(0);
    HadoopDataOutStream out = new HadoopDataOutStream(mem);
    final long ptr = mem.allocate(BUFF_SIZE);
    out.buffer().set(ptr, BUFF_SIZE);
    write(out);
    HadoopDataInStream in = new HadoopDataInStream(mem);
    in.buffer().set(ptr, out.buffer().pointer() - ptr);
    checkRead(in);
}
Also used : HadoopDataOutStream(org.apache.ignite.internal.processors.hadoop.shuffle.streams.HadoopDataOutStream) GridUnsafeMemory(org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory) HadoopDataInStream(org.apache.ignite.internal.processors.hadoop.shuffle.streams.HadoopDataInStream)

Example 2 with HadoopDataOutStream

use of org.apache.ignite.internal.processors.hadoop.shuffle.streams.HadoopDataOutStream in project ignite by apache.

the class HadoopDataStreamSelfTest method readLineByHadoopDataInStream.

/**
     * @param val String value.
     * @return List of strings are returned by readLine().
     * @throws IOException On error.
     */
List<String> readLineByHadoopDataInStream(String val) throws IOException {
    GridUnsafeMemory mem = new GridUnsafeMemory(0);
    HadoopDataOutStream out = new HadoopDataOutStream(mem);
    final long ptr = mem.allocate(BUFF_SIZE);
    out.buffer().set(ptr, BUFF_SIZE);
    out.write(val.getBytes());
    HadoopDataInStream in = new HadoopDataInStream(mem);
    in.buffer().set(ptr, out.buffer().pointer() - ptr);
    return readLineStrings(in);
}
Also used : HadoopDataOutStream(org.apache.ignite.internal.processors.hadoop.shuffle.streams.HadoopDataOutStream) GridUnsafeMemory(org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory) HadoopDataInStream(org.apache.ignite.internal.processors.hadoop.shuffle.streams.HadoopDataInStream)

Aggregations

HadoopDataInStream (org.apache.ignite.internal.processors.hadoop.shuffle.streams.HadoopDataInStream)2 HadoopDataOutStream (org.apache.ignite.internal.processors.hadoop.shuffle.streams.HadoopDataOutStream)2 GridUnsafeMemory (org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory)2