简体   繁体   English

jNetPcap重载openOffline()

[英]jNetPcap overloading openOffline()

I'm looking for a way to overload this function in jNetPcap: 我正在寻找一种在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? 我已经下载了源代码,但是此函数是native函数,如何去执行该函数并尝试对其进行更改?

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);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM