Package com.slytechs.utils.memory.channel

Examples of com.slytechs.utils.memory.channel.BufferedReadableByteChannel


      throws IOException {
    this.order = order;
    this.headerReader = headerReader;
    this.filter = filter;

    MarkableReadableByteChannel marked = new BufferedReadableByteChannel(in);
    this.in = new CountedReadableByteChannel(marked);

    this.block = readBlockRecord();
   
    this.dlt = ProtocolRegistry.lookup(getCaptureDevice().getLinkType());
View Full Code Here


    /*
     * Wrap the original input in buffer channel so that we can rewind and check
     * various types.
     */

    final BufferedReadableByteChannel b = new BufferedReadableByteChannel(in);
    b.mark(24); // Max number of bytes of all the known block headers

    if (PcapInputCapture.checkFormat(b) != null) {
      return FormatType.Pcap;
    }

    b.reset();

    if (SnoopInputCapture.checkFormat(b) != null) {
      return FormatType.Snoop;
    }

    b.reset();

    if (factoryForOther.getFactory().formatType(b) != null) {
      return FormatType.Other;
    }

View Full Code Here

    /*
     * Wrap the original input in buffer channel so that we can rewind and check
     * various types.
     */

    final BufferedReadableByteChannel b = new BufferedReadableByteChannel(in);
    b.mark(24); // Max number of bytes of all the known block headers

    if (PcapInputCapture.checkFormat(b) != null) {
      return new DefaultFormatTypeDetail(FormatType.Pcap);
    }

    b.reset();

    if (SnoopInputCapture.checkFormat(b) != null) {
      return new DefaultFormatTypeDetail(FormatType.Snoop);
    }

    b.reset();

    final FormatType.Detail detail;

    detail = factoryForOther.getFactory().formatTypeDetail(b);

View Full Code Here

  public <T extends InputCapture<? extends FilePacket>> T newInput(
      final Class<T> t, final ReadableByteChannel in,
      final Filter<ProtocolFilterTarget> filter) throws IOException {
    if (t == PcapInput.class) {
      final BufferedReadableByteChannel b = new BufferedReadableByteChannel(in);
      b.mark(4);

      ByteOrder order = PcapInputCapture.checkFormat(b);

      b.reset();
      return t.cast(new PcapInputCapture(b, order, filter));

    } else if (t == SnoopInput.class) {
      return t.cast(new SnoopInputCapture(in, filter));
    }
View Full Code Here

   */
  public InputCapture<? extends CapturePacket> newInput(
      final ReadableByteChannel in, final Filter<ProtocolFilterTarget> filter)
      throws IOException {

    final BufferedReadableByteChannel b = new BufferedReadableByteChannel(in);
    b.mark(24);

    final FormatType type = this.formatType(b);

    switch (type) {
      case Pcap:
        b.reset();
        ByteOrder order = PcapInputCapture.checkFormat(b);

        b.reset();
        return new PcapInputCapture(b, order, filter);

      case Snoop:
        return new SnoopInputCapture(b, filter);

        /**
         * Loads NPL based file formats. Use
         * <code>InputCapture.getFormatName()</code> to get a more accurate
         * name of the file format if its NPL based.
         */
      case Other:
        b.reset();
        return factoryForOther.getFactory().newInput(b, filter);

      default:
        /*
         * Otherwise throw an exception, we don't recognize the format
View Full Code Here

TOP

Related Classes of com.slytechs.utils.memory.channel.BufferedReadableByteChannel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.