src/main/java/pityoulish/sockets/tlv/HowToParseTLV.java
public static void parseTLV(byte[] data)
  {
    System.out.println("parsing from array of length "+data.length);

    // parsing a TLV interprets the tag and length
    ParseTLV<MsgBoardType> main = new MsgBoardTLV(data, 0);
    System.out.println(main.getType()+" at position "+main.getStart()+
                       ", value from "+main.getValueStart()+
                       " to "+(main.getEnd()-1));
    // getEnd() points to the position *after* the value

    // now loop over the nested TLVs that comprise the value of 'main'
    for (ParseTLV<MsgBoardType> nested = main.getNestedTLV();
         nested != null;
         nested = nested.getNextTLV(main.getEnd())
         )
     {
       System.out.println(nested.getType()+" at position "+nested.getStart()+
                          ", value from "+nested.getValueStart()+
                          " to "+(nested.getEnd()-1));
     }

    if (main.getEnd() < data.length)
       System.out.println("ignoring position "+main.getEnd()+" and beyond");
  }
/**
   * Parses a nested TLV structure.
   *
   * @param data        the encoded TLV structure
   */
Parses a nested TLV structure.
@param data        the encoded TLV structure
Parses a nested TLV structure . @param data the encoded TLV structure
public static void parseTLV(byte[] data)
  {
    System.out.println("parsing from array of length "+data.length);
    ParseTLV<MsgBoardType> main = new MsgBoardTLV(data, 0);
    System.out.println(main.getType()+" at position "+main.getStart()+
                       ", value from "+main.getValueStart()+
                       " to "+(main.getEnd()-1));
    for (ParseTLV<MsgBoardType> nested = main.getNestedTLV();
         nested != null;
         nested = nested.getNextTLV(main.getEnd())
         )
     {
       System.out.println(nested.getType()+" at position "+nested.getStart()+
                          ", value from "+nested.getValueStart()+
                          " to "+(nested.getEnd()-1));
     }
    if (main.getEnd() < data.length)
       System.out.println("ignoring position "+main.getEnd()+" and beyond");
  }
public static void parseTLV ( byte [ ] data ) { System . out . println ( "parsing from array of length " + data . length ) ; ParseTLV < MsgBoardType > main = new MsgBoardTLV ( data , 0 ) ; System . out . println ( main . getType ( ) + " at position " + main . getStart ( ) + ", value from " + main . getValueStart ( ) + " to " + ( main . getEnd ( ) - 1 ) ) ; for ( ParseTLV < MsgBoardType > nested = main . getNestedTLV ( ) ; nested != null ; nested = nested . getNextTLV ( main . getEnd ( ) ) ) { System . out . println ( nested . getType ( ) + " at position " + nested . getStart ( ) + ", value from " + nested . getValueStart ( ) + " to " + ( nested . getEnd ( ) - 1 ) ) ; } if ( main . getEnd ( ) < data . length ) System . out . println ( "ignoring position " + main . getEnd ( ) + " and beyond" ) ; }
Parses a nested TLV structure.
Parses a nested TLV structure .
// parsing a TLV interprets the tag and length // getEnd() points to the position *after* the value // now loop over the nested TLVs that comprise the value of 'main'