⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jpcapwriter.java

📁 jpcap是一个中间件
💻 JAVA
字号:
package jpcap;

import jpcap.packet.Packet;

/** This class is used to save the captured packets into a file. */
public class JpcapWriter
{
	private native String nativeOpenDumpFile(String filename,int ID);
	
	private JpcapWriter(JpcapCaptor jpcap,String filename)
			throws java.io.IOException{
		String ret=nativeOpenDumpFile(filename,jpcap.ID);
		
		if(ret!=null){ //error
			throw new java.io.IOException(ret);
		}
	}
	
	/** Opens a file to save the captured packets.
     * @param jpcap instance of Jpcap that was used to capture (load) packets
     * @param filename filename
     * @throws IOException If the file cannot be opened
     */
	public static JpcapWriter openDumpFile(JpcapCaptor jpcap,String filename) throws java.io.IOException{
		return new JpcapWriter(jpcap,filename);
	}
	
	/** Closes the opened file. */
	public native void close();
	
	/** Saves a packet into the file.
         * @param packet Packet to be saved
         */
	public native void writePacket(Packet packet);
	
  static{
    System.loadLibrary("jpcap");
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -