public InputStream getInputStream() throws SQLException, IOException, AuthorizeException { return getBitstreamService().retrieve(context, bitstream); }
protected byte[] getBytesFromBitstream(Context context, Item item, String bitstream_name) throws SQLException, IOException, AuthorizeException { Bitstream bs = getBitstream(item, bitstream_name); // no such bitstream if (bs == null) { return null; } // create a ByteArrayOutputStream ByteArrayOutputStream baos = new ByteArrayOutputStream(); Utils.copy(bitstreamService.retrieve(context, bs), baos); return baos.toByteArray(); }
ByteArrayOutputStream out = null; try { in = bitstreamService.retrieve(context, b); out = new ByteArrayOutputStream(); while (true) {
@Override public void disseminate(Context context, DSpaceObject dso, OutputStream out) throws CrosswalkException, IOException, SQLException, AuthorizeException { if (dso.getType() == Constants.ITEM) { Bitstream licenseBs = PackageUtils.findDepositLicense(context, (Item) dso); if (licenseBs != null) { Utils.copy(bitstreamService.retrieve(context, licenseBs), out); out.close(); } } }
@Override public void disseminate(Context context, DSpaceObject dso, OutputStream out) throws CrosswalkException, IOException, SQLException, AuthorizeException { if (dso.getType() == Constants.ITEM) { Bitstream cc = creativeCommonsService.getLicenseRdfBitstream((Item) dso); if (cc != null) { Utils.copy(bitstreamService.retrieve(context, cc), out); out.close(); } } }
@Override public void disseminate(Context context, DSpaceObject dso, OutputStream out) throws CrosswalkException, IOException, SQLException, AuthorizeException { if (dso.getType() == Constants.ITEM) { Bitstream cc = creativeCommonsService.getLicenseTextBitstream((Item) dso); if (cc != null) { Utils.copy(bitstreamService.retrieve(context, cc), out); out.close(); } } }
zip.putNextEntry(ze); InputStream is = bitstreamService .retrieve(context, bitstream); Utils.copy(is, zip); zip.closeEntry();
InputStream is = bitstreamService.retrieve(c, bitstream); FileOutputStream fos = new FileOutputStream(fout); Utils.bufferedCopy(is, fos);
@Override public Pair<InputStream, Long> makeCitedDocument(Context context, Bitstream bitstream) throws IOException, SQLException, AuthorizeException { PDDocument document = new PDDocument(); PDDocument sourceDocument = new PDDocument(); try { Item item = (Item) bitstreamService.getParentObject(context, bitstream); sourceDocument = sourceDocument.load(bitstreamService.retrieve(context, bitstream)); PDPage coverPage = new PDPage(citationPageFormat); generateCoverPage(context, document, coverPage, item); addCoverPageToDocument(document, sourceDocument, coverPage); //We already have the full PDF in memory, so keep it there try (ByteArrayOutputStream out = new ByteArrayOutputStream()) { document.save(out); byte[] data = out.toByteArray(); return Pair.of((InputStream) new ByteArrayInputStream(data), new Long(data.length)); } } finally { sourceDocument.close(); document.close(); } }
inputStream = bitstreamService.retrieve(context, dspaceBitstream); type = dspaceBitstream.getFormat(context).getMIMEType(); name = dspaceBitstream.getName();
Utils.copy(bitstreamService.retrieve(context, pkgBs), out); } finally { if (out != null) {
results = new ArrayList<String>(); for (Bitstream bitstream : bundle.getBitstreams()) { InputStream inputstream = bitstreamService.retrieve(Curator.curationContext(), bitstream); logDebugMessage("Scanning " + bitstream.getName() + " . . . "); int bstatus = scan(bitstream, inputstream, getItemHandle(item));
crosswalkPDF(context, myitem, bitstreamService.retrieve(context, bs));
InputStream srcStream = bitstreamService.retrieve(context, source);
private MediaResource getBitstreamResource(Context context, Bitstream bitstream) throws SwordServerException, SwordAuthException { try { InputStream stream = bitstreamService.retrieve(context, bitstream); MediaResource mr = new MediaResource(stream, bitstream.getFormat(context).getMIMEType(), null, true); mr.setContentMD5(bitstream.getChecksum()); mr.setLastModified(this.getLastModified(context, bitstream)); return mr; } catch (IOException | SQLException e) { throw new SwordServerException(e); } catch (AuthorizeException e) { throw new SwordAuthException(e); } }
InputStream in; try { in = bitstreamService.retrieve(context, licBit); ByteArrayOutputStream out = new ByteArrayOutputStream(); Utils.bufferedCopy(in, out);