Package java.nio.channels

Examples of java.nio.channels.FileChannel.transferTo()


    File file = QAUtil.createTestfile_40k();
    file.deleteOnExit();
    RandomAccessFile raf = new RandomAccessFile(file, "r");
    FileChannel fc = raf.getChannel();
   
    fc.transferTo(0, fc.size(), clientChannel);

    clientChannel.close();
    fc.close();
    raf.close();
   
View Full Code Here


   
    if (bodyDataSink.getFlushmode() != FlushMode.SYNC) {
      System.out.println("flush mode is not sync");
      Assert.fail("flush mode is not sync");
    }
    fc.transferTo(0, size, bodyDataSink);
    if (bodyDataSink.getFlushmode() != FlushMode.SYNC) {
      System.out.println("flush mode after copy is not sync");
      Assert.fail("flush mode after copy is not sync");
    }
    bodyDataSink.close();
View Full Code Here

   
    File file = QAUtil.createTestfile_40k();
    RandomAccessFile raf = new RandomAccessFile(file, "r");
    FileChannel fc = raf.getChannel();
   
    fc.transferTo(0, fc.size(), clientChannel);
   
    clientChannel.close();
    fc.close();
    raf.close();
   
View Full Code Here

   
    if (bodyDataSink.getFlushmode() != FlushMode.SYNC) {
      System.out.println("flush mode is not sync");
      Assert.fail("flush mode is not sync");
    }
    fc.transferTo(0, size, bodyDataSink);
    if (bodyDataSink.getFlushmode() != FlushMode.SYNC) {
      System.out.println("flush mode after copy is not sync");
      Assert.fail("flush mode after copy is not sync");
    }
    bodyDataSink.close();
View Full Code Here

   
    File file = QAUtil.createTestfile_40k();
    RandomAccessFile raf = new RandomAccessFile(file, "r");
    FileChannel fc = raf.getChannel();
   
    fc.transferTo(0, fc.size(), clientChannel);
   
    clientChannel.close();
    fc.close();
    raf.close();
   
View Full Code Here

    File file = QAUtil.createTestfile_40k();
    file.deleteOnExit();
    RandomAccessFile raf = new RandomAccessFile(file, "r");
    FileChannel fc = raf.getChannel();
   
    fc.transferTo(0, fc.size(), clientChannel);

    clientChannel.close();
    fc.close();
    raf.close();
   
View Full Code Here

   
    if (bodyDataSink.getFlushmode() != FlushMode.SYNC) {
      System.out.println("flush mode is not sync");
      Assert.fail("flush mode is not sync");
    }
    fc.transferTo(0, size, bodyDataSink);
    if (bodyDataSink.getFlushmode() != FlushMode.SYNC) {
      System.out.println("flush mode after copy is not sync");
      Assert.fail("flush mode after copy is not sync");
    }
    bodyDataSink.close();
View Full Code Here

   
    if (bodyDataSink.getFlushmode() != FlushMode.SYNC) {
      System.out.println("flush mode is not sync");
      Assert.fail("flush mode is not sync");
    }
    fc.transferTo(0, size, bodyDataSink);
    if (bodyDataSink.getFlushmode() != FlushMode.SYNC) {
      System.out.println("flush mode after copy is not sync");
      Assert.fail("flush mode after copy is not sync");
    }
    bodyDataSink.close();
View Full Code Here

        int safe_max = (64 * 1024 * 1024) / 4;
        long size = srcChannel.size();
        long position = 0;
        while (position < size)
        {
          position += srcChannel.transferTo(position, safe_max,
              dstChannel);
        }
      }

      // Close the channels
View Full Code Here

                long length = section.right - section.left;
                long bytesTransferred = 0;
                while (bytesTransferred < length)
                {
                    long toTransfer = Math.min(CHUNK_SIZE, length - bytesTransferred);
                    long lastWrite = fc.transferTo(section.left + bytesTransferred, toTransfer, channel);
                    bytesTransferred += lastWrite;
                    header.file.progress += lastWrite;
                }
                if (logger.isDebugEnabled())
                    logger.debug("Bytes transferred " + bytesTransferred + "/" + header.file.size);
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.