use of org.apache.nifi.processors.hadoop.util.InputStreamWritable in project nifi by apache.
the class SequenceFileWriterImpl method processInputStream.
protected void processInputStream(InputStream stream, FlowFile flowFile, final Writer writer) throws IOException {
int fileSize = (int) flowFile.getSize();
final InputStreamWritable inStreamWritable = new InputStreamWritable(new BufferedInputStream(stream), fileSize);
String key = flowFile.getAttribute(CoreAttributes.FILENAME.key());
writer.append(new Text(key), inStreamWritable);
}
use of org.apache.nifi.processors.hadoop.util.InputStreamWritable in project nifi by apache.
the class ZipUnpackerSequenceFileWriter method processInputStream.
@Override
protected void processInputStream(InputStream stream, final FlowFile flowFile, final Writer writer) throws IOException {
try (final ZipInputStream zipIn = new ZipInputStream(new BufferedInputStream(stream))) {
ZipEntry zipEntry;
while ((zipEntry = zipIn.getNextEntry()) != null) {
if (zipEntry.isDirectory()) {
continue;
}
final File file = new File(zipEntry.getName());
final String key = file.getName();
long fileSize = zipEntry.getSize();
final InputStreamWritable inStreamWritable = new InputStreamWritable(zipIn, (int) fileSize);
writer.append(new Text(key), inStreamWritable);
logger.debug("Appending FlowFile {} to Sequence File", new Object[] { key });
}
}
}
use of org.apache.nifi.processors.hadoop.util.InputStreamWritable in project nifi by apache.
the class TarUnpackerSequenceFileWriter method processInputStream.
@Override
protected void processInputStream(final InputStream stream, final FlowFile tarArchivedFlowFile, final Writer writer) throws IOException {
try (final TarArchiveInputStream tarIn = new TarArchiveInputStream(new BufferedInputStream(stream))) {
TarArchiveEntry tarEntry;
while ((tarEntry = tarIn.getNextTarEntry()) != null) {
if (tarEntry.isDirectory()) {
continue;
}
final String key = tarEntry.getName();
final long fileSize = tarEntry.getSize();
final InputStreamWritable inStreamWritable = new InputStreamWritable(tarIn, (int) fileSize);
writer.append(new Text(key), inStreamWritable);
logger.debug("Appending FlowFile {} to Sequence File", new Object[] { key });
}
}
}
Aggregations