static String validateTnf(short tnf,byte[] type,byte[] id,byte[] payload){
switch (tnf) {
case TNF_EMPTY:
    if (type.length != 0 || id.length != 0 || payload.length != 0) {
      return "unexpected data in TNF_EMPTY record";
    }
  return null;
case TNF_WELL_KNOWN:
case TNF_MIME_MEDIA:
case TNF_ABSOLUTE_URI:
case TNF_EXTERNAL_TYPE:
return null;
case TNF_UNKNOWN:
case TNF_RESERVED:
if (type.length != 0) {
return "unexpected type field in TNF_UNKNOWN or TNF_RESERVEd record";
}
return null;
case TNF_UNCHANGED:
return "unexpected TNF_UNCHANGED in first chunk or logical record";
default :
return String.format("unexpected tnf value: 0x%02x",tnf);
}
}

static String validateTnf ( short tnf , byte [ ] type , byte [ ] id , byte [ ] payload ) { switch ( tnf ) { case TNF_EMPTY : if ( type . length != 0 || id . length != 0 || payload . length != 0 ) { return "unexpected data in TNF_EMPTY record" ; } return null ; case TNF_WELL_KNOWN : case TNF_MIME_MEDIA : case TNF_ABSOLUTE_URI : case TNF_EXTERNAL_TYPE : return null ; case TNF_UNKNOWN : case TNF_RESERVED : if ( type . length != 0 ) { return "unexpected type field in TNF_UNKNOWN or TNF_RESERVEd record" ; } return null ; case TNF_UNCHANGED : return "unexpected TNF_UNCHANGED in first chunk or logical record" ; default : return String . format ( "unexpected tnf value: 0x%02x" , tnf ) ; } }
perform simple validation that the tnf is valid . < p > validates the requirements of nfcforum - ts - ndef_1 . 0 section 3 . 2 . 6 ( type name format ) . this just validates that the tnf is valid , and that the relevant type , id and payload fields are present ( or empty ) for this tnf . it does not perform any deep inspection of the type , id and payload fields . < p > also does not allow tnf_unchanged since this class is only used to present logical ( unchunked ) records .
