本文整理汇总了Java中org.jnetpcap.nio.JMemoryPool类的典型用法代码示例。如果您正苦于以下问题:Java JMemoryPool类的具体用法?Java JMemoryPool怎么用?Java JMemoryPool使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JMemoryPool类属于org.jnetpcap.nio包,在下文中一共展示了JMemoryPool类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SlidingBuffer
import org.jnetpcap.nio.JMemoryPool; //导入依赖的package包/类
/**
* Instantiates a new sliding buffer.
*
* @param size
* the size
*/
public SlidingBuffer(int size) {
this.size = size;
/*
* Allocate round robin buffer with padding so that we can duplicate a few
* bytes at the right edge of the real offset. This way if we're asked to
* read a value that is wrapped around mid way at the end of the buffer, we
* can just safely read it since those bytes have been duplicated.
*/
this.storage = JMemoryPool.buffer(size + JNumber.Type.getBiggestSize());
}
示例2: getMemoryPool
import org.jnetpcap.nio.JMemoryPool; //导入依赖的package包/类
/**
* Gets the current memory allocation memory pool.
*
* @return current memory pool
*/
public static JMemoryPool getMemoryPool() {
return pool;
}
示例3: setMemoryPool
import org.jnetpcap.nio.JMemoryPool; //导入依赖的package包/类
/**
* Replaces the default memory allocation mechanism with user supplied one.
*
* @param pool
* new memory pool to use.
*/
public static void setMemoryPool(JMemoryPool pool) {
JPacket.pool = pool;
}
示例4: setMemoryPool
import org.jnetpcap.nio.JMemoryPool; //导入依赖的package包/类
/**
* Replaces the default memory allocation mechanism with user supplied one.
*
* @param pool
* new memory pool to use.
*/
public static void setMemoryPool(JMemoryPool pool) {
JPacket.pool = pool;
}