Search code examples
javajnetpcap

jNetPcap overloading openOffline()


I'm looking for a way to overload this function in jNetPcap:

Pcap openOffline(String fname, StringBuilder errbuf);

I want to implement it in this way:

Pcap openOffline(InputStraem stream, StringBuilder errbuf);

I have downloaded the source code but this function is a native function, how can I go to the implementation of this function and try to change it?


Solution

  • You could declare your method as static and make a call to the original native method from within your method.

    Something like

    static Pcap openOffline(InputStream stream, StringBuilder errbuf) {
        String fname;
        doSomeThing(); //Extract a string from the inputstream and store it in fname
        return openOffline(fname, errbuf);
    }