src/main/java/xyz/issc/daca/Coder.java
public FullMessage oneshotDecode() {
        if (byteBuff.getAvailability() < metaLen) {
            setStatus(STATUS_IDLE);
            byteBuff.flush();
            return null;
        }
        meta = parseMeta();
        String type = meta.getType();

        if (StringUtils.isEmpty(type)) {
            //invalid type
            byteBuff.flush();
            invalidateDecoding();
            return null;
        }

        Code matchCode = codeBook.getCodeByType(type);
        if (matchCode != null) {
            //set decoding status
            payload = new Message();
            payload.setType(type);
            AttrSegment[] attrSegs = code.getAttrSegments();
            for (AttrSegment seg : attrSegs) {
                int attrLen = 0;
                if (seg.isVariant()) {
                    //TODO variant determining
                    attrLen = fetchMetaAttrLen(seg.getName());
                }
                else {
                    attrLen = seg.getLen();
                }
                byteBuff.pop(buff, calcSegmentLen(seg.getOffset(), seg.getParseLen(), attrLen));

                Svo attr = parseAttr(buff, seg.getOffset(), seg, attrLen);
                payload.putAttr(seg.getName(), attr);
            }
            return new FullMessage(meta, payload);
        }
        else {
            //invalid code type, skip decoding
            byteBuff.flush();
            invalidateDecoding();
            return null;
        }

   }
/**
     * headless decode, parsing the whole buff into one message
     * @return
     */
headless decode, parsing the whole buff into one message
@return
headless decode parsing the whole buff into one message @return
public FullMessage oneshotDecode() {
        if (byteBuff.getAvailability() < metaLen) {
            setStatus(STATUS_IDLE);
            byteBuff.flush();
            return null;
        }
        meta = parseMeta();
        String type = meta.getType();
        if (StringUtils.isEmpty(type)) {
            byteBuff.flush();
            invalidateDecoding();
            return null;
        }
        Code matchCode = codeBook.getCodeByType(type);
        if (matchCode != null) {
            payload = new Message();
            payload.setType(type);
            AttrSegment[] attrSegs = code.getAttrSegments();
            for (AttrSegment seg : attrSegs) {
                int attrLen = 0;
                if (seg.isVariant()) {
                    attrLen = fetchMetaAttrLen(seg.getName());
                }
                else {
                    attrLen = seg.getLen();
                }
                byteBuff.pop(buff, calcSegmentLen(seg.getOffset(), seg.getParseLen(), attrLen));
                Svo attr = parseAttr(buff, seg.getOffset(), seg, attrLen);
                payload.putAttr(seg.getName(), attr);
            }
            return new FullMessage(meta, payload);
        }
        else {
            byteBuff.flush();
            invalidateDecoding();
            return null;
        }
   }
public FullMessage oneshotDecode ( ) { if ( byteBuff . getAvailability ( ) < metaLen ) { setStatus ( STATUS_IDLE ) ; byteBuff . flush ( ) ; return null ; } meta = parseMeta ( ) ; String type = meta . getType ( ) ; if ( StringUtils . isEmpty ( type ) ) { byteBuff . flush ( ) ; invalidateDecoding ( ) ; return null ; } Code matchCode = codeBook . getCodeByType ( type ) ; if ( matchCode != null ) { payload = new Message ( ) ; payload . setType ( type ) ; AttrSegment [ ] attrSegs = code . getAttrSegments ( ) ; for ( AttrSegment seg : attrSegs ) { int attrLen = 0 ; if ( seg . isVariant ( ) ) { attrLen = fetchMetaAttrLen ( seg . getName ( ) ) ; } else { attrLen = seg . getLen ( ) ; } byteBuff . pop ( buff , calcSegmentLen ( seg . getOffset ( ) , seg . getParseLen ( ) , attrLen ) ) ; Svo attr = parseAttr ( buff , seg . getOffset ( ) , seg , attrLen ) ; payload . putAttr ( seg . getName ( ) , attr ) ; } return new FullMessage ( meta , payload ) ; } else { byteBuff . flush ( ) ; invalidateDecoding ( ) ; return null ; } }
headless decode, parsing the whole buff into one message
 @return
headless decode parsing the whole buff into one message @return
//invalid type //set decoding status //TODO variant determining //invalid code type, skip decoding