Examples of RandomAccessBuffer


Examples of freenet.support.api.RandomAccessBuffer

   * @return True if we handled the message (i.e. always).
   */
  public boolean handleRequestRevocation(Message m, final PeerNode source) {
    // Do we have the data?

    final RandomAccessBuffer data = updateManager.revocationChecker.getBlobBuffer();

    if(data == null) {
      Logger.normal(this, "Peer " + source + " asked us for the blob file for the revocation key but we don't have it!");
      // Probably a race condition on reconnect, hopefully we'll be asked again
      return true;
    }

    final long uid = m.getLong(DMT.UID);

    final PartiallyReceivedBulk prb;
    long length;
    length = data.size();
    prb = new PartiallyReceivedBulk(updateManager.node.getUSM(), length,
            Node.PACKET_SIZE, data, true);

    final BulkTransmitter bt;
    try {
      bt = new BulkTransmitter(prb, source, uid, false, updateManager.ctr, true);
    } catch(DisconnectedException e) {
      Logger.error(this, "Peer " + source + " asked us for the blob file for the revocation key, then disconnected: " + e, e);
      data.close();
      return true;
    }

    final Runnable r = new Runnable() {

      @Override
      public void run() {
        try {
          if(!bt.send())
            Logger.error(this, "Failed to send revocation key blob to " + source.userToString() + " : " + bt.getCancelReason());
          else
            Logger.normal(this, "Sent revocation key blob to " + source.userToString());
        } catch (DisconnectedException e) {
          // Not much we can do here either.
          Logger.warning(this, "Failed to send revocation key blob (disconnected) to " + source.userToString() + " : " + bt.getCancelReason());
        } finally {
          data.close();
        }
      }
    };

    Message msg = DMT.createUOMSendingRevocation(uid, length, updateManager.getRevocationURI().toString());
View Full Code Here

Examples of org.apache.pdfbox.io.RandomAccessBuffer

                    pdfDocument = PDDocument.load(new CloseShieldInputStream(stream), scratchFile, true);
                }
            } else {
                // Go for the normal, stream based in-memory parsing
                if (localConfig.getUseNonSequentialParser() == true){
                    pdfDocument = PDDocument.loadNonSeq(new CloseShieldInputStream(stream), new RandomAccessBuffer());
                } else {
                    pdfDocument = PDDocument.load(new CloseShieldInputStream(stream), true);
                }
            }
           
View Full Code Here

Examples of org.apache.pdfbox.io.RandomAccessBuffer

        {
            createScratchFile(scratchDirectory);
        }
        if (buffer == null)
        {
            buffer = new RandomAccessBuffer();
        }
    }
View Full Code Here

Examples of org.apache.pdfbox.io.RandomAccessBuffer

        {
            createScratchFile(scratchDirectory);
        }
        if (buffer == null)
        {
            buffer = new RandomAccessBuffer();
        }
    }
View Full Code Here

Examples of org.apache.pdfbox.io.RandomAccessBuffer

        assertTrue(pdf.length > 200);
        assertEquals("%PDF-1.4", new String(copyOfRange(pdf, 0, 8), "UTF-8"));
        assertEquals("%%EOF\n", new String(copyOfRange(pdf, pdf.length - 6, pdf.length), "UTF-8"));

        // Load
        PDDocument loadDoc = PDDocument.load(new ByteArrayInputStream(pdf), new RandomAccessBuffer());
        assertEquals(1, loadDoc.getNumberOfPages());
        loadDoc.close();
    }
View Full Code Here

Examples of org.apache.pdfbox.io.RandomAccessBuffer

        assertTrue(pdf.length > 200);
        assertEquals("%PDF-1.4", new String(copyOfRange(pdf, 0, 8), "UTF-8"));
        assertEquals("%%EOF\n", new String(copyOfRange(pdf, pdf.length - 6, pdf.length), "UTF-8"));

        // Load
        PDDocument loadDoc = PDDocument.load(targetFile, new RandomAccessBuffer());
        assertEquals(1, loadDoc.getNumberOfPages());
        loadDoc.close();
    }
View Full Code Here

Examples of org.apache.pdfbox.io.RandomAccessBuffer

        assertTrue(pdf.length > 200);
        assertEquals("%PDF-1.4", new String(copyOfRange(pdf, 0, 8), "UTF-8"));
        assertEquals("%%EOF\n", new String(copyOfRange(pdf, pdf.length - 6, pdf.length), "UTF-8"));

        // Load
        PDDocument loadDoc = PDDocument.loadNonSeq(new ByteArrayInputStream(pdf), new RandomAccessBuffer());
        assertEquals(1, loadDoc.getNumberOfPages());
        loadDoc.close();
    }
View Full Code Here

Examples of org.apache.pdfbox.io.RandomAccessBuffer

        assertTrue(pdf.length > 200);
        assertEquals("%PDF-1.4", new String(copyOfRange(pdf, 0, 8), "UTF-8"));
        assertEquals("%%EOF\n", new String(copyOfRange(pdf, pdf.length - 6, pdf.length), "UTF-8"));

        // Load
        PDDocument loadDoc = PDDocument.loadNonSeq(targetFile, new RandomAccessBuffer());
        assertEquals(1, loadDoc.getNumberOfPages());
        loadDoc.close();
    }
View Full Code Here

Examples of org.apache.pdfbox.io.RandomAccessBuffer

   
    private COSStream createContentStream(COSBase contents) throws IOException
    {
        List<COSStream> contentStreams = createContentStreamList(contents);
        // concatenate streams
        COSStream concatStream = new COSStream(new RandomAccessBuffer());
        OutputStream out = concatStream.createUnfilteredStream();
        for (COSStream contentStream : contentStreams)
        {
            InputStream in = contentStream.getUnfilteredStream();
            byte[] buf = new byte[2048];
View Full Code Here

Examples of org.apache.pdfbox.io.RandomAccessBuffer

                + xObjectId + " Do Q\nQ\n");
    }

    private COSStream createStream(String content) throws IOException
    {
        COSStream stream = new COSStream(new RandomAccessBuffer());
        OutputStream out = stream.createUnfilteredStream();
        out.write(content.getBytes("ISO-8859-1"));
        out.close();
        stream.setFilters(COSName.FLATE_DECODE);
        return stream;
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.