class Pcaps {

  public static PcapHandle openDead(DataLinkType dlt, int snaplen) throws PcapNativeException {
    if (dlt == null) {
      StringBuilder sb = new StringBuilder();
      sb.append("dlt: ").append(dlt);
      throw new NullPointerException(sb.toString());
    }

    Pointer handle = NativeMappings.pcap_open_dead(dlt.value(), snaplen);
    if (handle == null) {
      StringBuilder sb = new StringBuilder(50);
      sb.append("Failed to open a PcapHandle. dlt: ")
          .append(dlt)
          .append(" snaplen: ")
          .append(snaplen);
      throw new PcapNativeException(sb.toString());
    }

    return new PcapHandle(handle, TimestampPrecision.MICRO);
  }

  private  Pcaps();

}