Examples of SyncFlushByteBufferOutputStream


Examples of org.apache.hama.bsp.message.io.SyncFlushByteBufferOutputStream

    File f = null;
    try {
      String fileName = System.getProperty("java.io.tmpdir")
          + File.separatorChar + "testSyncFlushByteBufferOutputStream.txt";
      SyncFlushByteBufferOutputStream stream = new SyncFlushByteBufferOutputStream(
          fileName);
      DirectByteBufferOutputStream syncFlushStream = new DirectByteBufferOutputStream(
          stream);
      ByteBuffer buffer = ByteBuffer.allocateDirect(512);
      syncFlushStream.setBuffer(buffer);
View Full Code Here

Examples of org.apache.hama.bsp.message.io.SyncFlushByteBufferOutputStream

  public void testSyncFlushBufferInputStream() throws Exception {
    File f = null;
    try {
      String fileName = System.getProperty("java.io.tmpdir")
          + File.separatorChar + "testSyncFlushBufferInputStream.txt";
      SyncFlushByteBufferOutputStream stream = new SyncFlushByteBufferOutputStream(
          fileName);
      DirectByteBufferOutputStream syncFlushStream = new DirectByteBufferOutputStream(
          stream);
      ByteBuffer buffer = ByteBuffer.allocateDirect(512);
      syncFlushStream.setBuffer(buffer);
      IntWritable intWritable = new IntWritable(1);

      for (int i = 0; i < 200; ++i) {
        intWritable.set(i);
        intWritable.write(syncFlushStream);
      }
      intWritable.write(syncFlushStream);
      syncFlushStream.close();

      f = new File(fileName);
      assertTrue(f.exists());
      assertEquals(f.length(), 804);

      SyncReadByteBufferInputStream syncReadStream = new SyncReadByteBufferInputStream(
          stream.isSpilled(), fileName);
      DirectByteBufferInputStream inStream = new DirectByteBufferInputStream(
          syncReadStream);
      buffer.clear();
      inStream.setBuffer(buffer);
View Full Code Here

Examples of org.apache.hama.bsp.message.io.SyncFlushByteBufferOutputStream

    File f = null;
    try {
      String fileName = System.getProperty("java.io.tmpdir")
          + File.separatorChar + "testSyncFlushByteBufferOutputStream.txt";
      SyncFlushByteBufferOutputStream stream = new SyncFlushByteBufferOutputStream(
          fileName);
      DirectByteBufferOutputStream syncFlushStream = new DirectByteBufferOutputStream(
          stream);
      ByteBuffer buffer = ByteBuffer.allocateDirect(512);
      syncFlushStream.setBuffer(buffer);
View Full Code Here

Examples of org.apache.hama.bsp.message.io.SyncFlushByteBufferOutputStream

  public void testSyncFlushBufferInputStream() throws Exception {
    File f = null;
    try {
      String fileName = System.getProperty("java.io.tmpdir")
          + File.separatorChar + "testSyncFlushBufferInputStream.txt";
      SyncFlushByteBufferOutputStream stream = new SyncFlushByteBufferOutputStream(
          fileName);
      DirectByteBufferOutputStream syncFlushStream = new DirectByteBufferOutputStream(
          stream);
      ByteBuffer buffer = ByteBuffer.allocateDirect(512);
      syncFlushStream.setBuffer(buffer);
      IntWritable intWritable = new IntWritable(1);

      for (int i = 0; i < 200; ++i) {
        intWritable.set(i);
        intWritable.write(syncFlushStream);
      }
      intWritable.write(syncFlushStream);
      syncFlushStream.close();

      f = new File(fileName);
      assertTrue(f.exists());
      assertEquals(f.length(), 804);

      SyncReadByteBufferInputStream syncReadStream = new SyncReadByteBufferInputStream(
          stream.isSpilled(), fileName);
      DirectByteBufferInputStream inStream = new DirectByteBufferInputStream(
          syncReadStream);
      buffer.clear();
      inStream.setBuffer(buffer);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.