@Override public void process(final InputStream in) throws IOException { StreamUtils.copy(in, baos); } });
@Override public void process(final OutputStream out) throws IOException { StreamUtils.copy(in, out); } });
@Override public void process(final InputStream in) throws IOException { StreamUtils.copy(in, baos); } });
@Override public void process(InputStream in) throws IOException { try (BufferedInputStream input = new BufferedInputStream(in)) { StreamUtils.copy(input, baos); } baos.close(); } });
@Override public void process(InputStream in, OutputStream out) throws IOException { try (Base64OutputStream bos = new Base64OutputStream(out)) { StreamUtils.copy(in, bos); } } }
@Override public void process(InputStream in, OutputStream out) throws IOException { try (Base32OutputStream bos = new Base32OutputStream(out)) { StreamUtils.copy(in, bos); } } }
@Override public long importFrom(final InputStream content, final ContentClaim claim) throws IOException { try (final OutputStream out = write(claim, false)) { return StreamUtils.copy(content, out); } }
@Override public void write(final OutputStream output) throws IOException, WebApplicationException { try (InputStream is = content.getContent()) { // stream the content to the response StreamUtils.copy(is, output); // flush the response output.flush(); } } };
@Override public void process(OutputStream out) throws IOException { readStdoutReadable(ignoreStdin, stdinWritable, logger, incomingFlowFileIS); StreamUtils.copy(stdoutReadable, out); try { exitCode = process.waitFor(); } catch (InterruptedException e) { logger.warn("Command Execution Process was interrupted", e); } } });
@Override public long exportTo(final ContentClaim claim, final OutputStream destination) throws IOException { if (claim == null) { return 0L; } try (final InputStream in = read(claim)) { return StreamUtils.copy(in, destination); } }
@Override public void write(OutputStream output) throws IOException, WebApplicationException { try (InputStream is = content.getContent()) { // stream the content to the response StreamUtils.copy(is, output); // flush the response output.flush(); } } };
@Override public void write(OutputStream output) throws IOException, WebApplicationException { try (InputStream is = content.getContent()) { // stream the content to the response StreamUtils.copy(is, output); // flush the response output.flush(); } } };
@Override public long exportTo(ContentClaim claim, OutputStream destination) throws IOException { final InputStream in = read(claim); try { return StreamUtils.copy(in, destination); } finally { IOUtils.closeQuietly(in); } }
@Override public void process(final InputStream in) throws IOException { try (ByteArrayOutputStream holder = new ByteArrayOutputStream()) { StreamUtils.copy(in,holder); String hashValue = generateHash(algorithm, holder.toString()); if (StringUtils.isBlank(hashValue) == false) { hashValueHolder.set(hashValue); } } } });
@Override public void process(final InputStream in) throws IOException { try (final DigestOutputStream digestOut = new DigestOutputStream(new NullOutputStream(), digest)) { StreamUtils.copy(in, digestOut); final byte[] hash = digest.digest(); final StringBuilder strb = new StringBuilder(hash.length * 2); for (int i = 0; i < hash.length; i++) { strb.append(Integer.toHexString((hash[i] & 0xFF) | 0x100), 1, 3); } hashValueHolder.set(strb.toString()); } } });
@Override public long exportTo(ContentClaim claim, OutputStream destination, long offset, long length) throws IOException { final InputStream in = read(claim); try { StreamUtils.skip(in, offset); StreamUtils.copy(in, destination, length); } finally { IOUtils.closeQuietly(in); } return length; }
@Override public void encode(final DataPacket dataPacket, final OutputStream encodedOut) throws IOException { final DataOutputStream out = new DataOutputStream(encodedOut); final Map<String, String> attributes = dataPacket.getAttributes(); out.writeInt(attributes.size()); for (final Map.Entry<String, String> entry : attributes.entrySet()) { writeString(entry.getKey(), out); writeString(entry.getValue(), out); } out.writeLong(dataPacket.getSize()); final InputStream in = dataPacket.getData(); StreamUtils.copy(in, encodedOut); encodedOut.flush(); }
@Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { final ServletOutputStream out = resp.getOutputStream(); try (final FileInputStream fis = new FileInputStream("src/test/resources/hello.txt")) { StreamUtils.copy(fis, out); } }
@Override public void process(InputStream in, OutputStream out) throws IOException { try (Base64InputStream bis = new Base64InputStream(new ValidatingBase64InputStream(in))) { StreamUtils.copy(bis, out); } } }
@Override public long importFrom(final InputStream in, final ContentClaim claim) throws IOException { final ContentClaim backupClaim = getBackupClaim(claim); if (backupClaim == null) { final ContentBlock content = getContent(claim); content.reset(); return StreamUtils.copy(in, content.write()); } else { return getBackupRepository().importFrom(in, claim); } }