0

我正在寻找一种在 jNetPcap 中重载此函数的方法:

Pcap openOffline(String fname, StringBuilder errbuf);

我想以这种方式实现它:

Pcap openOffline(InputStraem stream, StringBuilder errbuf);

我已经下载了源代码但是这个函数是一个native函数,我该如何去实现这个函数并尝试改变它?

4

1 回答 1

0

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);
}
于 2014-10-27T16:52:46.590 回答