Code example for NdefRecord

0
        } 
        // missing '/' is allowed 
 
        // MIME RFCs suggest ASCII encoding for content-type 
        byte[] typeBytes = mimeType.getBytes(Charset.forName("US_ASCII"));
        return new NdefRecord(NdefRecord.TNF_MIME_MEDIA, typeBytes, new byte[0], mimeData);
    } 
 
    public static NdefRecord createExternal(String domain, String type, byte[] data) {
        if (domain == null) throw new NullPointerException("domain is null");
        if (type == null) throw new NullPointerException("type is null");
 
        domain = domain.trim().toLowerCase(Locale.US);
        type = type.trim().toLowerCase(Locale.US);
 
        if (domain.length() == 0) throw new IllegalArgumentException("domain is empty");
        if (type.length() == 0) throw new IllegalArgumentException("type is empty");
 
        byte[] byteDomain = domain.getBytes(Charset.forName("UTF_8"));
        byte[] byteType = type.getBytes(Charset.forName("UTF_8"));
Experience pair programming with AI  Get Codota for Java