Package freenet.support.io

Examples of freenet.support.io.FileRandomAccessBuffer


        @Override
        public void run() {
          boolean failed = false;
          File tmp = null;
          FileRandomAccessBuffer raf = null;
          try {
            System.out.println("Fetching "+saveTo+" from "+fetchFrom);
            long uid = updateManager.node.fastWeakRandom.nextLong();
            fetchFrom.sendAsync(DMT.createUOMFetchDependency(uid, expectedHash, size), null, updateManager.ctr);
            tmp = FileUtil.createTempFile(saveTo.getName(), NodeUpdateManager.TEMP_FILE_SUFFIX, saveTo.getParentFile());
            raf = new FileRandomAccessBuffer(tmp, size, false);
            PartiallyReceivedBulk prb =
              new PartiallyReceivedBulk(updateManager.node.getUSM(), size,
                Node.PACKET_SIZE, raf, false);
            BulkReceiver br = new BulkReceiver(prb, fetchFrom, uid, updateManager.ctr);
            failed = !br.receive();
            raf.close();
            raf = null;
            if(!failed) {
              // Check the hash.
              if(MainJarDependenciesChecker.validFile(tmp, expectedHash, size, executable)) {
                if(FileUtil.renameTo(tmp, saveTo)) {
View Full Code Here

TOP

Related Classes of freenet.support.io.FileRandomAccessBuffer

Copyright © 2018 www.massapicom. 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.