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);
}
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);
}
Aggregations