Package java.nio.channels

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


                dos.writeBoolean(true);
                handler.writeAdditionalHeader(dos);
            }

            // send file using zero-copy send
            nbytes = fc.transferTo(fromPos, xferBytes, channel);
            if(LOG.isDebugEnabled()) {
                LOG.debug("Sent a file '" + file.getAbsolutePath() + "' of " + nbytes
                        + " bytes to " + dstSockAddr.toString() + " in " + sw.toString());
            }
View Full Code Here


        FileInputStream fis = new FileInputStream(f);
        FileChannel in = fis.getChannel();
        WritableByteChannel out = Channels.newChannel(response.getOutputStream());
        try {
          in.transferTo(0, in.size(), out);
          service.removeFile(id);
        } catch (Exception e) {
          throw e;
        } finally {
          in.close();
View Full Code Here

      File bakFile = new File(javaFile.getAbsolutePath()+".bak");
      FileOutputStream fos = new FileOutputStream(bakFile);
      fos.write(DEFAULT_HEADER.getBytes());
      FileChannel fc = raf.getChannel();
      long count = raf.length() - endOfHeader;
      fc.transferTo(endOfHeader, count, fos.getChannel());
      fc.close();
      fos.close();
      raf.close();
      if( javaFile.delete() == false )
         log.severe("Failed to delete java file: "+javaFile);
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

   
    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();
    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();
    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

   
    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

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.