Examples of transferTo()


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

   
    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

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

   
    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

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

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

   
    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

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

   
    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

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

        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

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

                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

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

               
                long bytesTransferred;
                try
                {
                    /* returns the number of bytes transferred from file to the socket */
                    bytesTransferred = fc.transferTo(startPosition, limit, socketChannel_);
                }
                catch (IOException e)
                {
                    // at least jdk1.6.0 on Linux seems to throw IOException
                    // when the socket is full. (Bug fixed for 1.7: http://bugs.sun.com/view_bug.do?bug_id=5103988)
View Full Code Here

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

    try {

      // write out the checksum type and bytesperchecksum to client
      // skip the first two bytes that describe the version
      long val = mch.transferTo(versionSize, cheaderSize, out);
      if (val != cheaderSize) {
        String msg = "readBlockAccelerator for block  " + block +
                     " at offset " + 0 +
                     " but could not transfer checksum header.";
        LOG.warn(msg);
View Full Code Here

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

      if (LOG.isDebugEnabled()) {
        LOG.debug("readBlockAccelerator metaOffset "  +  startMetaOffset +
                  " mlength " +  metaLength);
      }
      // write out the checksums back to the client
      val = mch.transferTo(startMetaOffset, metaLength, out);
      if (val != metaLength) {
        String msg = "readBlockAccelerator for block  " + block +
                     " at offset " + startMetaOffset +
                     " but could not transfer checksums of size " +
                     metaLength + ". Transferred only " + val;
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.