@Override public void process(final InputStream in) throws IOException { StreamUtils.fillBuffer(in, content, 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, 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(final InputStream in) throws IOException { StreamUtils.fillBuffer(in, messageContent, true); } });
@Override public void process(final InputStream in) throws IOException { StreamUtils.fillBuffer(in, buffer); } });
/** * 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(InputStream in) throws IOException { StreamUtils.fillBuffer(in, byteBuffer, false); } });
@Override public void process(final InputStream in) throws IOException { StreamUtils.fillBuffer(in, byteArray, true); } });
@Override public void process(final InputStream in) throws IOException { bufferedByteCount.set(StreamUtils.fillBuffer(in, buffer, false)); } });
private String readString(final DataInputStream in) throws IOException { final int numBytes = in.readInt(); final byte[] bytes = new byte[numBytes]; StreamUtils.fillBuffer(in, bytes, true); return new String(bytes, "UTF-8"); }
private String readLongString(final DataInputStream in) throws IOException { final int stringLength = in.readInt(); final byte[] bytes = new byte[stringLength]; StreamUtils.fillBuffer(in, bytes); return new String(bytes, StandardCharsets.UTF_8); }
@Override public void process(final InputStream in, final OutputStream out) throws IOException { StreamUtils.fillBuffer(in, buffer, false); final String contentString = new String(buffer, 0, flowFileSize, charset); // Interpreting the search and replacement values as char sequences final String updatedValue = contentString.replace(searchValue, replacementValue); out.write(updatedValue.getBytes(charset)); } });
@Override public void process(InputStream in) throws IOException { StreamUtils.fillBuffer(in, buffer, false); } });
@Override public void process(InputStream in) throws IOException { StreamUtils.fillBuffer(in, buffer, false); } });
@Override protected void readHeader(final DataInputStream in, final int serializationVersion) throws IOException { verifySerializationVersion(serializationVersion); final int schemaLength = in.readInt(); final byte[] buffer = new byte[schemaLength]; StreamUtils.fillBuffer(in, buffer); try (final ByteArrayInputStream bais = new ByteArrayInputStream(buffer)) { schema = RecordSchema.readFrom(bais); } recordReader = SchemaRecordReader.fromSchema(schema); }
/** * Extracts contents of the {@link FlowFile} as byte array. */ private byte[] extractMessageBody(FlowFile flowFile, ProcessSession session) { final byte[] messageContent = new byte[(int) flowFile.getSize()]; session.read(flowFile, in -> StreamUtils.fillBuffer(in, messageContent, true)); return messageContent; }