Search in sources :

Example 1 with PcapRecordReader

use of net.ripe.hadoop.pcap.io.reader.PcapRecordReader in project hadoop-pcap by RIPE-NCC.

the class PcapInputFormat method initPcapRecordReader.

public static PcapRecordReader initPcapRecordReader(Path path, long start, long length, TaskAttemptContext context) throws IOException {
    Configuration conf = context.getConfiguration();
    FileSystem fs = path.getFileSystem(conf);
    FSDataInputStream baseStream = fs.open(path);
    DataInputStream stream = baseStream;
    CompressionCodecFactory compressionCodecs = new CompressionCodecFactory(conf);
    final CompressionCodec codec = compressionCodecs.getCodec(path);
    if (codec != null)
        stream = new DataInputStream(codec.createInputStream(stream));
    PcapReader reader = initPcapReader(stream, conf);
    return new PcapRecordReader(reader, start, length, baseStream, stream, context);
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) CompressionCodecFactory(org.apache.hadoop.io.compress.CompressionCodecFactory) PcapReader(net.ripe.hadoop.pcap.PcapReader) FileSystem(org.apache.hadoop.fs.FileSystem) FSDataInputStream(org.apache.hadoop.fs.FSDataInputStream) PcapRecordReader(net.ripe.hadoop.pcap.io.reader.PcapRecordReader) CompressionCodec(org.apache.hadoop.io.compress.CompressionCodec) DataInputStream(java.io.DataInputStream) FSDataInputStream(org.apache.hadoop.fs.FSDataInputStream)

Example 2 with PcapRecordReader

use of net.ripe.hadoop.pcap.io.reader.PcapRecordReader in project hadoop-pcap by RIPE-NCC.

the class PcapRecordReaderTest method startup.

@Before
public void startup() throws IOException {
    JobConf config = new JobConf();
    FileSystem fs = FileSystem.get(config);
    FSDataInputStream is = fs.open(new Path(TEST_FILE.getParent(), TEST_FILE.getName()));
    recordReader = new PcapRecordReader(new PcapReader(is), 0L, TEST_FILE.length(), is, is, new TestableTaskAttemptContext(config));
}
Also used : Path(org.apache.hadoop.fs.Path) PcapReader(net.ripe.hadoop.pcap.PcapReader) FileSystem(org.apache.hadoop.fs.FileSystem) FSDataInputStream(org.apache.hadoop.fs.FSDataInputStream) PcapRecordReader(net.ripe.hadoop.pcap.io.reader.PcapRecordReader) JobConf(org.apache.hadoop.mapred.JobConf) Before(org.junit.Before)

Example 3 with PcapRecordReader

use of net.ripe.hadoop.pcap.io.reader.PcapRecordReader in project hadoop-pcap by RIPE-NCC.

the class PcapIPv6RecordReaderTest method startup.

@Before
public void startup() throws IOException {
    JobConf config = new JobConf();
    FileSystem fs = FileSystem.get(config);
    FSDataInputStream is = fs.open(new Path(TEST_FILE.getParent(), TEST_FILE.getName()));
    recordReader = new PcapRecordReader(new PcapReader(is), 0L, TEST_FILE.length(), is, is, new TestableTaskAttemptContext(config));
}
Also used : Path(org.apache.hadoop.fs.Path) PcapReader(net.ripe.hadoop.pcap.PcapReader) FileSystem(org.apache.hadoop.fs.FileSystem) FSDataInputStream(org.apache.hadoop.fs.FSDataInputStream) PcapRecordReader(net.ripe.hadoop.pcap.io.reader.PcapRecordReader) JobConf(org.apache.hadoop.mapred.JobConf) Before(org.junit.Before)

Example 4 with PcapRecordReader

use of net.ripe.hadoop.pcap.io.reader.PcapRecordReader in project hadoop-pcap by RIPE-NCC.

the class PcapReversedHeaderRecordReaderTest method startup.

@Before
public void startup() throws IOException {
    JobConf config = new JobConf();
    FileSystem fs = FileSystem.get(config);
    FSDataInputStream is = fs.open(new Path(TEST_FILE.getParent(), TEST_FILE.getName()));
    recordReader = new PcapRecordReader(new PcapReader(is), 0L, TEST_FILE.length(), is, is, new TestableTaskAttemptContext(config));
}
Also used : Path(org.apache.hadoop.fs.Path) PcapReader(net.ripe.hadoop.pcap.PcapReader) FileSystem(org.apache.hadoop.fs.FileSystem) FSDataInputStream(org.apache.hadoop.fs.FSDataInputStream) PcapRecordReader(net.ripe.hadoop.pcap.io.reader.PcapRecordReader) JobConf(org.apache.hadoop.mapred.JobConf) Before(org.junit.Before)

Aggregations

PcapReader (net.ripe.hadoop.pcap.PcapReader)4 PcapRecordReader (net.ripe.hadoop.pcap.io.reader.PcapRecordReader)4 FSDataInputStream (org.apache.hadoop.fs.FSDataInputStream)4 FileSystem (org.apache.hadoop.fs.FileSystem)4 Path (org.apache.hadoop.fs.Path)3 JobConf (org.apache.hadoop.mapred.JobConf)3 Before (org.junit.Before)3 DataInputStream (java.io.DataInputStream)1 Configuration (org.apache.hadoop.conf.Configuration)1 CompressionCodec (org.apache.hadoop.io.compress.CompressionCodec)1 CompressionCodecFactory (org.apache.hadoop.io.compress.CompressionCodecFactory)1