Lines Matching refs:type

39  * typed data, such as MIME-type media, a URI, or a custom
53 * <li><em>type</em>: detailed typing for the payload</li>
60 * NDEF Records with correctly set tnf, type, id and payload fields, please
95 * Indicates the type field contains a well-known RTD type name.<p>
98 * The RTD type name format is specified in NFCForum-TS-RTD_1.0.
108 * Indicates the type field contains a media-type BNF
110 * Use this with MIME type names such as {@literal "image/jpeg"}, or
118 * Indicates the type field contains an absolute-URI
129 * Indicates the type field contains an external type name.<p>
132 * The external-type RTD format is specified in NFCForum-TS-RTD_1.0.<p>
142 * Indicates the payload type is unknown.<p>
144 * "application/octet-stream" MIME type. The payload
145 * type is not explicitly encoded within the record.
147 * The type field is empty in an {@literal TNF_UNKNOWN} record.
161 * Reserved TNF type.
170 * RTD Text type. For use with {@literal TNF_WELL_KNOWN}.
176 * RTD URI type. For use with {@literal TNF_WELL_KNOWN}.
182 * RTD Smart Poster type. For use with {@literal TNF_WELL_KNOWN}.
188 * RTD Alternative Carrier type. For use with {@literal TNF_WELL_KNOWN}.
194 * RTD Handover Carrier type. For use with {@literal TNF_WELL_KNOWN}.
200 * RTD Handover Request type. For use with {@literal TNF_WELL_KNOWN}.
206 * RTD Handover Select type. For use with {@literal TNF_WELL_KNOWN}.
212 * RTD Android app type. For use with {@literal TNF_EXTERNAL}.
214 * The payload of a record with type RTD_ANDROID_APP
320 * Uses the well known URI type representation: {@link #TNF_WELL_KNOWN}
363 * Uses the well known URI type representation: {@link #TNF_WELL_KNOWN}
403 * @param mimeType a valid MIME type
412 // We only do basic MIME type validation: trying to follow the
418 if (slashIndex == 0) throw new IllegalArgumentException("mimeType must have major type");
420 throw new IllegalArgumentException("mimeType must have minor type");
424 // MIME RFCs suggest ASCII encoding for content-type
433 * a domain-specific type. This data is packaged into a "NFC Forum External
435 * NFC Forum requires that the domain and type used in an external record
437 * always case sensitive. So this method will force the domain and type to
440 * if the domain and type have serious problems, for example if either field
451 * @param type domain-specific type of data
453 * @throws IllegalArugmentException if either domain or type are empty or invalid
455 public static NdefRecord createExternal(String domain, String type, byte[] data) {
457 if (type == null) throw new NullPointerException("type is null");
460 type = type.trim().toLowerCase(Locale.US);
463 if (type.length() == 0) throw new IllegalArgumentException("type is empty");
466 byte[] byteType = type.getBytes(Charsets.UTF_8);
484 * Basic validation of the tnf, type, id and payload is performed
488 * <li>Records with a tnf of {@link #TNF_EMPTY} cannot have a type,
491 * cannot have a type.</li>
499 * Deep inspection of the type, id and payload fields is not
503 * example, the payload may be invalid given the tnf and type.
505 * To omit a type, id or payload field, set the parameter to an
509 * @param type byte array, containing zero to 255 bytes, or null
515 public NdefRecord(short tnf, byte[] type, byte[] id, byte[] payload) {
517 if (type == null) type = EMPTY_BYTE_ARRAY;
521 String message = validateTnf(tnf, type, id, payload);
527 mType = type;
565 * TNF is the top-level type.
578 * does not have a type field.
624 * Map this record to a MIME type, or return null if it cannot be mapped.<p>
627 * {@link #RTD_TEXT}. If this is a MIME record then the MIME type as string
629 * This method does not perform validation that the MIME type is
631 * return a string containing the type if this is a MIME record.<p>
632 * The returned MIME type will by normalized to lower-case using
636 * @return MIME type as a string, or null if this is not a MIME record
657 * <li>{@link #TNF_WELL_KNOWN} with a type of {@link #RTD_URI}.</li>
658 * <li>{@link #TNF_WELL_KNOWN} with a type of {@link #RTD_SMART_POSTER}
747 byte[] type = null;
785 throw new FormatException("expected zero-length type in non-leading chunk");
789 type = (typeLength > 0 ? new byte[typeLength] : EMPTY_BYTE_ARRAY);
791 buffer.get(type);
831 String error = validateTnf(tnf, type, id, payload);
835 records.add(new NdefRecord(tnf, type, id, payload));
857 * is valid, and that the relevant type, id and payload
859 * perform any deep inspection of the type, id and payload fields.<p>
865 static String validateTnf(short tnf, byte[] type, byte[] id, byte[] payload) {
868 if (type.length != 0 || id.length != 0 || payload.length != 0) {
879 if (type.length != 0) {
880 return "unexpected type field in TNF_UNKNOWN or TNF_RESERVEd record";
955 byte[] type = new byte[typeLength];
956 in.readByteArray(type);
964 return new NdefRecord(tnf, type, id, payload);
985 * identical tnf, type, id and payload fields.
1002 if (mType.length > 0) b.append(" type=").append(bytesToString(mType));