Package org.activeio

Examples of org.activeio.Packet.flip()


        for(int i=0; i < 256; i++) {
            assertTrue(packet.write(i));
        }
        assertFalse(packet.write(0));
       
        packet.flip();
        for(int i=0; i < 256; i++) {
            assertEquals(i, packet.read());
        }      
        assertEquals(-1, packet.read());       
    }
View Full Code Here


            assertEquals(data.length, packet.write(data,0,data.length));
        }
        assertEquals(-1, packet.write(data,0,data.length));
       
        byte buffer[] = new byte[data.length];
        packet.flip();
        for(int i=0; i < 10; i++) {
            assertEquals(buffer.length, packet.read(buffer,0,buffer.length));
            Arrays.fill(data,(byte)i);
            assertEquals(buffer, data);
        }      
View Full Code Here

    }
   
    public void testFlip() {
        Packet packet = createTestPacket(100);
        packet.position(95);
        packet.flip();       
        assertEquals(0, packet.position());
        assertEquals(95, packet.limit());
    }
   
    public void testClear() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.