Examples of FlexBuffer


Examples of org.apache.etch.util.FlexBuffer

  /** @throws Exception */
  @Test
  public void data4() throws Exception
  {
    // 2x length = 1
    FlexBuffer buf = new FlexBuffer( new byte[]
    {
      // packet 1 header:
      -34, -83, -66, -17, 0, 0, 0, 1,
        // packet 1 data:
        1,
View Full Code Here

Examples of org.apache.etch.util.FlexBuffer

  /** @throws Exception */
  @Test
  public void doubleSingleData2() throws Exception
  {
    // length = 2
    FlexBuffer buf = new FlexBuffer( new byte[]
    {
      // packet 1 header:
      -34, -83, -66, -17, 0, 0, 0, 2,
        // packet 1 data:
        3, 4,
View Full Code Here

Examples of org.apache.etch.util.FlexBuffer

  /** @throws Exception */
  @Test
  public void doubleSingle_HeaderSplit_Data0() throws Exception
  {
    // length = 0
    FlexBuffer buf = new FlexBuffer( new byte[]
    {
      // packet 1 header (partial):
      -34, -83, -66, -17, 0, 0
    } );

    p.sessionData( who, buf );

    assertNull( session.what );
    assertTrue( session.check( null ) );
    assertNull( session.sender );

    FlexBuffer buf2 = new FlexBuffer( new byte[]
    {
      // packet 1 header (remainder):
        0, 0,
      // packet 2 header
        -34, -83, -66, -17, 0, 0, 0, 0
View Full Code Here

Examples of org.apache.etch.util.FlexBuffer

  /** @throws Exception */
  @Test
  public void doubleSingle_HeaderSplit_Data1() throws Exception
  {
    // length = 1
    FlexBuffer buf = new FlexBuffer( new byte[]
    {
      // packet 1 header (partial):
      -34, -83, -66, -17, 0, 0
    } );

    p.sessionData( who, buf );

    assertNull( session.what );
    assertTrue( session.check( null ) );
    assertNull( session.sender );

    FlexBuffer buf2 = new FlexBuffer( new byte[]
    {
      // packet 1 header (remainder):
        0, 1,
        // packet 1 data:
        1,
View Full Code Here

Examples of org.apache.etch.util.FlexBuffer

  /** @throws Exception */
  @Test
  public void doubleSingle_HeaderSplit_Data2() throws Exception
  {
    // length = 2
    FlexBuffer buf = new FlexBuffer( new byte[]
    {
      -34, -83, -66, -17, 0, 0
    } );

    p.sessionData( who, buf );

    assertNull( session.what );
    assertTrue( session.check( null ) );
    assertNull( session.sender );

    FlexBuffer buf2 = new FlexBuffer( new byte[]
    {
        0, 2, 3, 4, -34, -83, -66, -17, 0, 0, 0, 2, 5, 6
    } );
    byte[][] result2 = new byte[][]
    {
View Full Code Here

Examples of org.apache.etch.util.FlexBuffer

  /** @throws Exception */
  @Test
  public void doubleSingle_BodySplit_Data2() throws Exception
  {
    // length = 2
    FlexBuffer buf = new FlexBuffer( new byte[]
    {
      -34, -83, -66, -17, 0, 0, 0, 2, 1
    } );

    p.sessionData( who, buf );

    assertNull( session.what );
    assertTrue( session.check( null ) );
    assertNull( session.sender );

    FlexBuffer buf2 = new FlexBuffer( new byte[]
    {
        2, -34, -83, -66, -17, 0, 0, 0, 2, 3, 4
    } );
    byte[][] result2 = new byte[][]
    {
View Full Code Here

Examples of org.apache.etch.util.FlexBuffer

  /** @throws Exception */
  @Test
  public void doubleSingle_BodySplit_Data3() throws Exception
  {
    // length = 3
    FlexBuffer buf = new FlexBuffer( new byte[]
    {
      -34, -83, -66, -17, 0, 0, 0, 3, 5, 6
    } );

    p.sessionData( who, buf );

    assertNull( session.what );
    assertTrue( session.check( null ) );
    assertNull( session.sender );

    FlexBuffer buf2 = new FlexBuffer( new byte[]
    {
        7, -34, -83, -66, -17, 0, 0, 0, 3, 8, 9, 10
    } );
    byte[][] result2 = new byte[][]
    {
View Full Code Here

Examples of org.apache.etch.util.FlexBuffer

   
    assertWhat( What.UP, dh.what );
    assertNull( dh.xsender );
    assertNull( dh.xbuf );
   
    c.transportData( null, new FlexBuffer( new byte[] { 21, 22, 23 } ) );
    c.flush();
   
    InputStream is = t.getInputStream();
    assertEquals( 21, is.read() );
    assertEquals( 22, is.read() );
View Full Code Here

Examples of org.apache.etch.util.FlexBuffer

       
        buf.flip();
        byte[] bbuf = new byte[buf.remaining()];
        buf.get( bbuf );
       
        FlexBuffer fbuf = new FlexBuffer( bbuf );
        session.sessionData( null, fbuf );
      }
      finally
      {
        if (buf != null)
View Full Code Here

Examples of org.apache.etch.util.FlexBuffer

    final InputStream is = inputStream;
    if (is == null)
      throw new IOException( "socket closed" );
   
    // TODO allow setting input buffer size.
    final FlexBuffer buf = new FlexBuffer( new byte[8192] );
   
    try
    {
      while (isStarted())
      {
//        System.out.println( "reading" );
        int n = is.read( buf.getBuf() );
//        System.out.println( "read "+n );
       
        if (n <= 0)
          break;
       
        buf.setLength( n );
        buf.setIndex( 0 );
        fireData( buf );
      }
    }
    catch ( SocketException e )
    {
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.