當前位置: 首頁>>代碼示例>>Java>>正文


Java PeeringException類代碼示例

本文整理匯總了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));
}
 
開發者ID:pvenne,項目名稱:jgoose,代碼行數:28,代碼來源:TestJBuffer.java

示例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));
}
 
開發者ID:pvenne,項目名稱:jgoose,代碼行數:28,代碼來源:TestJBuffer.java

示例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));
}
 
開發者ID:pvenne,項目名稱:jgoose,代碼行數:30,代碼來源:TestJBuffer.java

示例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));
}
 
開發者ID:pvenne,項目名稱:jgoose,代碼行數:30,代碼來源:TestJBuffer.java

示例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));
}
 
開發者ID:pvenne,項目名稱:jgoose,代碼行數:24,代碼來源:TestJBuffer.java

示例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));
}
 
開發者ID:pvenne,項目名稱:jgoose,代碼行數:24,代碼來源:TestJBuffer.java

示例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));
}
 
開發者ID:pvenne,項目名稱:jgoose,代碼行數:24,代碼來源:TestJBuffer.java

示例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));
}
 
開發者ID:pvenne,項目名稱:jgoose,代碼行數:24,代碼來源:TestJBuffer.java

示例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));
}
 
開發者ID:pvenne,項目名稱:jgoose,代碼行數:24,代碼來源:TestJBuffer.java

示例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));
}
 
開發者ID:pvenne,項目名稱:jgoose,代碼行數:24,代碼來源:TestJBuffer.java

示例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));
}
 
開發者ID:pvenne,項目名稱:jgoose,代碼行數:24,代碼來源:TestJBuffer.java

示例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));
}
 
開發者ID:pvenne,項目名稱:jgoose,代碼行數:24,代碼來源:TestJBuffer.java

示例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));
 }
 
開發者ID:pvenne,項目名稱:jgoose,代碼行數:30,代碼來源:TestJBuffer.java

示例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));
 }
 
開發者ID:pvenne,項目名稱:jgoose,代碼行數:30,代碼來源:TestJBuffer.java

示例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));
 }
 
開發者ID:pvenne,項目名稱:jgoose,代碼行數:30,代碼來源:TestJBuffer.java


注:本文中的org.jnetpcap.packet.PeeringException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。