public StandardDataPacket(final Map<String, String> attributes, final InputStream stream, final long size) { this.attributes = attributes; this.stream = new MinimumLengthInputStream(new LimitingInputStream(stream, size), size); this.size = size; }
@Override public void process(final InputStream in) throws IOException { StreamUtils.fillBuffer(in, content, true); } });
@Override public void process(final InputStream in) throws IOException { StreamUtils.copy(in, baos); } });
@Override public long getBytesWritten() { return countingOut.getBytesWritten(); } }
@Override public void consume() throws IOException { if (countingIn == null) { return; } final byte[] b = new byte[4096]; int bytesRead; do { bytesRead = countingIn.read(b); } while (bytesRead > 0); }
@Override public synchronized void write(final byte[] b, final int off, final int len) throws IOException { super.write(b, off, len); } }
private void resetReadClaim() { try { if (currentReadClaimStream != null) { currentReadClaimStream.close(); } } catch (final Exception e) { } currentReadClaimStream = null; currentReadClaim = null; }
@Override public int read(final byte[] b) throws IOException { if (b.length == 0) { return 0; } return read(b, 0, b.length); }
@Override public void process(final InputStream in) throws IOException { StreamUtils.fillBuffer(in, buffer); } });
@Override public void process(final InputStream in) throws IOException { StreamUtils.fillBuffer(in, messageContent, true); } });
@Override public void process(final InputStream in) throws IOException { StreamUtils.fillBuffer(in, messageContent, true); } });
@Override public void process(final InputStream in) throws IOException { StreamUtils.fillBuffer(in, buffer); } });
@Override public void process(final InputStream in) throws IOException { StreamUtils.fillBuffer(in, buffer, false); } });
@Override public void process(InputStream in) throws IOException { StreamUtils.fillBuffer(in, byteBuffer, false); } });
@Override public void process(final InputStream in) throws IOException { StreamUtils.fillBuffer(in, buffer); } });
@Override public void process(final InputStream in) throws IOException { StreamUtils.fillBuffer(in, messageContent, true); } });
@Override public void process(final InputStream in) throws IOException { StreamUtils.fillBuffer(in, buff); } });
/** * Reads data from the given input stream, copying it to the destination byte array. If the InputStream has less data than the given byte array, throws an EOFException * * @param source the source to copy bytes from * @param destination the destination to fill * @throws IOException if any issues occur reading bytes */ public static void fillBuffer(final InputStream source, final byte[] destination) throws IOException { fillBuffer(source, destination, true); }
@Override public void process(final InputStream in) throws IOException { StreamUtils.fillBuffer(in, buffer); } });
@Override public void process(final InputStream in) throws IOException { StreamUtils.fillBuffer(in, byteArray, true); } });