Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ public static int fillBuffer(final InputStream source, final byte[] destination,
* @throws IllegalArgumentException if the given byte array is smaller than <code>byteCount</code> elements.
* @throws EOFException if the InputStream does not have <code>byteCount</code> bytes in the InputStream
* @throws IOException if unable to read from the InputStream
* @deprecated Use {@link InputStream#readNBytes(byte[], int, int)} instead.
*/
@Deprecated(since = "2.12.0", forRemoval = true)
public static void read(final InputStream source, final byte[] destination, final int byteCount) throws IOException {
if (destination.length < byteCount) {
throw new IllegalArgumentException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.apache.nifi.processor.exception.ProcessException;
import org.apache.nifi.processor.io.InputStreamCallback;
import org.apache.nifi.processor.util.StandardValidators;
import org.apache.nifi.stream.io.StreamUtils;

import java.io.BufferedInputStream;
import java.io.IOException;
Expand Down Expand Up @@ -196,7 +195,7 @@ public PCAPStreamSplitterCallback(ProcessSession session, FlowFile flowFile, int

private Packet getNextPacket(final BufferedInputStream bufferedStream, final PCAP templatePcap, final int totalPackets) throws IOException {
final byte[] packetHeader = new byte[Packet.PACKET_HEADER_LENGTH];
StreamUtils.read(bufferedStream, packetHeader, Packet.PACKET_HEADER_LENGTH);
bufferedStream.readNBytes(packetHeader, 0, Packet.PACKET_HEADER_LENGTH);

final Packet currentPacket = new Packet(packetHeader, templatePcap);

Expand All @@ -206,7 +205,7 @@ private Packet getNextPacket(final BufferedInputStream bufferedStream, final PCA

final int expectedLength = (int) currentPacket.expectedLength();
final byte[] packetBody = new byte[expectedLength];
StreamUtils.read(bufferedStream, packetBody, expectedLength);
bufferedStream.readNBytes(packetBody, 0, expectedLength);
currentPacket.setBody(packetBody);

if (currentPacket.isInvalid()) {
Expand All @@ -227,7 +226,7 @@ public void process(final InputStream inStream) throws IOException {
}

final byte[] pcapHeader = new byte[PCAPHeader.PCAP_HEADER_LENGTH];
StreamUtils.read(bufferedStream, pcapHeader, PCAPHeader.PCAP_HEADER_LENGTH);
bufferedStream.readNBytes(pcapHeader, 0, PCAPHeader.PCAP_HEADER_LENGTH);

int currentPcapTotalLength = PCAPHeader.PCAP_HEADER_LENGTH;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ private void verifyChecksum(final Checksum checksum, final InputStream in, final

private long readChecksum(final InputStream in) throws IOException {
final byte[] buffer = getDataBuffer();
StreamUtils.read(in, buffer, 8);
in.readNBytes(buffer, 0, 8);
return ByteBuffer.wrap(buffer, 0, 8).getLong();
}

Expand Down
Loading