本文整理汇总了Java中org.jnetpcap.packet.PeeringException类的典型用法代码示例。如果您正苦于以下问题:Java PeeringException类的具体用法?Java PeeringException怎么用?Java PeeringException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PeeringException类属于org.jnetpcap.packet包,在下文中一共展示了PeeringException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetByteArrayIntByteArray
import org.jnetpcap.packet.PeeringException; //导入依赖的package包/类
/**
* Test method for {@link org.jnetpcap.nio.JBuffer#getByteArray(int, byte[])}.
* @throws PeeringException
*/
public final void testGetByteArrayIntByteArray() throws PeeringException {
ByteBuffer src = ByteBuffer.allocateDirect(8);
byte[] sa = new byte[] {
(byte) 0xaa,
2,
10,
11,
12,
13,
3,
(byte) 0xbb };
src.put(sa);
src.flip();
JBuffer peer = new JBuffer(Type.POINTER);
peer.peer(src);
assertEquals(8, peer.size());
byte[] array = new byte[8];
assertEquals(8, peer.getByteArray(0, array).length);
assertTrue(Arrays.equals(sa, array));
}
示例2: testGetByteArrayIntInt
import org.jnetpcap.packet.PeeringException; //导入依赖的package包/类
/**
* Test method for {@link org.jnetpcap.nio.JBuffer#getByteArray(int, int)}.
* @throws PeeringException
*/
public final void testGetByteArrayIntInt() throws PeeringException {
ByteBuffer src = ByteBuffer.allocateDirect(8);
byte[] sa = new byte[] {
(byte) 0xaa,
2,
10,
11,
12,
13,
3,
(byte) 0xbb };
src.put(sa);
src.flip();
JBuffer peer = new JBuffer(Type.POINTER);
peer.peer(src);
assertEquals(8, peer.size());
byte[] array = peer.getByteArray(0, sa.length);
assertEquals(8, array.length);
assertTrue(Arrays.equals(sa, array));
}
示例3: testIsReadonly
import org.jnetpcap.packet.PeeringException; //导入依赖的package包/类
/**
* Test method for {@link org.jnetpcap.nio.JBuffer#isReadonly()}.
* @throws PeeringException
*/
public final void testIsReadonly() throws PeeringException {
ByteBuffer src = ByteBuffer.allocateDirect(8);
byte[] sa = new byte[] {
(byte) 0xaa,
2,
10,
11,
12,
13,
3,
(byte) 0xbb };
src.put(sa);
src.flip();
src = src.asReadOnlyBuffer();
JBuffer peer = new JBuffer(Type.POINTER);
peer.peer(src);
assertEquals(8, peer.size());
assertTrue(peer.isReadonly());
byte[] array = peer.getByteArray(0, sa.length);
assertEquals(8, array.length);
assertTrue(Arrays.equals(sa, array));
}
示例4: testSetByteArray
import org.jnetpcap.packet.PeeringException; //导入依赖的package包/类
/**
* Test method for {@link org.jnetpcap.nio.JBuffer#setByteArray(int, byte[])}.
* @throws PeeringException
*/
public final void testSetByteArray() throws PeeringException {
ByteBuffer src = ByteBuffer.allocateDirect(8);
src.clear();
byte[] sa = new byte[] {
(byte) 0xaa,
2,
10,
11,
12,
13,
3,
(byte) 0xbb };
JBuffer peer = new JBuffer(Type.POINTER);
peer.peer(src);
assertEquals(8, peer.size());
peer.setByteArray(0, sa);
byte[] array = new byte[8];
src.get(array);
assertTrue(Arrays.equals(sa, array));
}
示例5: testSetDouble
import org.jnetpcap.packet.PeeringException; //导入依赖的package包/类
/**
* Test method for {@link org.jnetpcap.nio.JBuffer#setDouble(int, double)}.
* @throws PeeringException
*/
public final void testSetDouble() throws PeeringException {
ByteBuffer src = ByteBuffer.allocateDirect(8);
src.clear();
JBuffer peer = new JBuffer(Type.POINTER);
peer.peer(src);
assertEquals(8, peer.size());
src.order(ByteOrder.LITTLE_ENDIAN);
peer.order(ByteOrder.LITTLE_ENDIAN);
peer.setDouble(0, 10e32f);
assertEquals(src.getDouble(0), peer.getDouble(0));
src.order(ByteOrder.BIG_ENDIAN);
peer.order(ByteOrder.BIG_ENDIAN);
assertEquals(src.getDouble(0), peer.getDouble(0));
}
示例6: testSetFloat
import org.jnetpcap.packet.PeeringException; //导入依赖的package包/类
/**
* Test method for {@link org.jnetpcap.nio.JBuffer#setFloat(int, float)}.
* @throws PeeringException
*/
public final void testSetFloat() throws PeeringException {
ByteBuffer src = ByteBuffer.allocateDirect(4);
src.clear();
JBuffer peer = new JBuffer(Type.POINTER);
peer.peer(src);
assertEquals(4, peer.size());
src.order(ByteOrder.LITTLE_ENDIAN);
peer.order(ByteOrder.LITTLE_ENDIAN);
peer.setFloat(0, 10e32f);
assertEquals(src.getFloat(0), peer.getFloat(0));
src.order(ByteOrder.BIG_ENDIAN);
peer.order(ByteOrder.BIG_ENDIAN);
assertEquals(src.getFloat(0), peer.getFloat(0));
}
示例7: testSetInt
import org.jnetpcap.packet.PeeringException; //导入依赖的package包/类
/**
* Test method for {@link org.jnetpcap.nio.JBuffer#setInt(int, int)}.
* @throws PeeringException
*/
public final void testSetInt() throws PeeringException {
ByteBuffer src = ByteBuffer.allocateDirect(4);
src.clear();
JBuffer peer = new JBuffer(Type.POINTER);
peer.peer(src);
assertEquals(4, peer.size());
src.order(ByteOrder.LITTLE_ENDIAN);
peer.order(ByteOrder.LITTLE_ENDIAN);
peer.setInt(0, 10);
assertEquals(src.getInt(0), peer.getInt(0));
src.order(ByteOrder.BIG_ENDIAN);
peer.order(ByteOrder.BIG_ENDIAN);
assertEquals(src.getInt(0), peer.getInt(0));
}
示例8: testSetLong
import org.jnetpcap.packet.PeeringException; //导入依赖的package包/类
/**
* Test method for {@link org.jnetpcap.nio.JBuffer#setLong(int, long)}.
* @throws PeeringException
*/
public final void testSetLong() throws PeeringException {
ByteBuffer src = ByteBuffer.allocateDirect(8);
src.clear();
JBuffer peer = new JBuffer(Type.POINTER);
peer.peer(src);
assertEquals(8, peer.size());
src.order(ByteOrder.LITTLE_ENDIAN);
peer.order(ByteOrder.LITTLE_ENDIAN);
peer.setLong(0, 10);
assertEquals(src.getLong(0), peer.getLong(0));
src.order(ByteOrder.BIG_ENDIAN);
peer.order(ByteOrder.BIG_ENDIAN);
assertEquals(src.getLong(0), peer.getLong(0));
}
示例9: testSetShort
import org.jnetpcap.packet.PeeringException; //导入依赖的package包/类
/**
* Test method for {@link org.jnetpcap.nio.JBuffer#setShort(int, short)}.
* @throws PeeringException
*/
public final void testSetShort() throws PeeringException {
ByteBuffer src = ByteBuffer.allocateDirect(8);
src.clear();
JBuffer peer = new JBuffer(Type.POINTER);
peer.peer(src);
assertEquals(8, peer.size());
src.order(ByteOrder.LITTLE_ENDIAN);
peer.order(ByteOrder.LITTLE_ENDIAN);
peer.setShort(0, (short) 10);
assertEquals(src.getShort(0), peer.getShort(0));
src.order(ByteOrder.BIG_ENDIAN);
peer.order(ByteOrder.BIG_ENDIAN);
assertEquals(src.getShort(0), peer.getShort(0));
}
示例10: testSetUByte
import org.jnetpcap.packet.PeeringException; //导入依赖的package包/类
/**
* Test method for {@link org.jnetpcap.nio.JBuffer#setUByte(int, int)}.
* @throws PeeringException
*/
public final void testSetUByte() throws PeeringException {
ByteBuffer src = ByteBuffer.allocateDirect(8);
src.clear();
JBuffer peer = new JBuffer(Type.POINTER);
peer.peer(src);
assertEquals(8, peer.size());
src.order(ByteOrder.LITTLE_ENDIAN);
peer.order(ByteOrder.LITTLE_ENDIAN);
peer.setUByte(0, 10);
assertEquals(src.get(0), peer.getUByte(0));
src.order(ByteOrder.BIG_ENDIAN);
peer.order(ByteOrder.BIG_ENDIAN);
assertEquals(src.get(0), peer.getUByte(0));
}
示例11: testSetUInt
import org.jnetpcap.packet.PeeringException; //导入依赖的package包/类
/**
* Test method for {@link org.jnetpcap.nio.JBuffer#setUInt(int, long)}.
* @throws PeeringException
*/
public final void testSetUInt() throws PeeringException {
ByteBuffer src = ByteBuffer.allocateDirect(8);
src.clear();
JBuffer peer = new JBuffer(Type.POINTER);
peer.peer(src);
assertEquals(8, peer.size());
src.order(ByteOrder.LITTLE_ENDIAN);
peer.order(ByteOrder.LITTLE_ENDIAN);
peer.setUInt(0, 10);
assertEquals(src.getInt(0), peer.getUInt(0));
src.order(ByteOrder.BIG_ENDIAN);
peer.order(ByteOrder.BIG_ENDIAN);
assertEquals(src.getInt(0), peer.getUInt(0));
}
示例12: testSetUShort
import org.jnetpcap.packet.PeeringException; //导入依赖的package包/类
/**
* Test method for {@link org.jnetpcap.nio.JBuffer#setUShort(int, int)}.
* @throws PeeringException
*/
public final void testSetUShort() throws PeeringException {
ByteBuffer src = ByteBuffer.allocateDirect(8);
src.clear();
JBuffer peer = new JBuffer(Type.POINTER);
peer.peer(src);
assertEquals(8, peer.size());
src.order(ByteOrder.LITTLE_ENDIAN);
peer.order(ByteOrder.LITTLE_ENDIAN);
peer.setUShort(0, 10);
assertEquals(src.getShort(0), peer.getUShort(0));
src.order(ByteOrder.BIG_ENDIAN);
peer.order(ByteOrder.BIG_ENDIAN);
assertEquals(src.getShort(0), peer.getUShort(0));
}
示例13: testJBufferByte
import org.jnetpcap.packet.PeeringException; //导入依赖的package包/类
/**
* Test j buffer byte.
*
* @throws PeeringException
* the peering exception
*/
public void testJBufferByte() throws PeeringException {
ByteBuffer src = ByteBuffer.allocateDirect(4);
src.put(new byte[] {
1,
2,
3,
4 });
src.flip();
JBuffer peer = new JBuffer(Type.POINTER);
peer.peer(src);
assertEquals(4, peer.size());
src.order(ByteOrder.LITTLE_ENDIAN);
peer.order(ByteOrder.LITTLE_ENDIAN);
assertEquals(src.get(0), peer.getByte(0));
src.order(ByteOrder.BIG_ENDIAN);
peer.order(ByteOrder.BIG_ENDIAN);
assertEquals(src.get(0), peer.getByte(0));
}
示例14: testJBufferShort
import org.jnetpcap.packet.PeeringException; //导入依赖的package包/类
/**
* Test j buffer short.
*
* @throws PeeringException
* the peering exception
*/
public void testJBufferShort() throws PeeringException {
ByteBuffer src = ByteBuffer.allocateDirect(4);
src.put(new byte[] {
1,
2,
3,
4 });
src.flip();
JBuffer peer = new JBuffer(Type.POINTER);
peer.peer(src);
assertEquals(4, peer.size());
src.order(ByteOrder.LITTLE_ENDIAN);
peer.order(ByteOrder.LITTLE_ENDIAN);
assertEquals(src.getShort(0), peer.getShort(0));
src.order(ByteOrder.BIG_ENDIAN);
peer.order(ByteOrder.BIG_ENDIAN);
assertEquals(src.getShort(0), peer.getShort(0));
}
示例15: testJBufferInt
import org.jnetpcap.packet.PeeringException; //导入依赖的package包/类
/**
* Test j buffer int.
*
* @throws PeeringException
* the peering exception
*/
public void testJBufferInt() throws PeeringException {
ByteBuffer src = ByteBuffer.allocateDirect(4);
src.put(new byte[] {
1,
2,
3,
4 });
src.flip();
JBuffer peer = new JBuffer(Type.POINTER);
peer.peer(src);
assertEquals(4, peer.size());
src.order(ByteOrder.LITTLE_ENDIAN);
peer.order(ByteOrder.LITTLE_ENDIAN);
assertEquals(src.getInt(0), peer.getInt(0));
src.order(ByteOrder.BIG_ENDIAN);
peer.order(ByteOrder.BIG_ENDIAN);
assertEquals(src.getInt(0), peer.getInt(0));
}