compat/src/main/java/androidx/core/provider/FontsContractCompat.java
@RestrictTo(LIBRARY_GROUP)
    @RequiresApi(19)
    public static Map<Uri, ByteBuffer> prepareFontData(Context context, FontInfo[] fonts,
            CancellationSignal cancellationSignal) {
        final HashMap<Uri, ByteBuffer> out = new HashMap<>();

        for (FontInfo font : fonts) {
            if (font.getResultCode() != Columns.RESULT_CODE_OK) {
                continue;
            }

            final Uri uri = font.getUri();
            if (out.containsKey(uri)) {
                continue;
            }

            ByteBuffer buffer = TypefaceCompatUtil.mmap(context, cancellationSignal, uri);
            out.put(uri, buffer);
        }
        return Collections.unmodifiableMap(out);
    }
/**
     * A helper function to create a mapping from {@link Uri} to {@link ByteBuffer}.
     *
     * Skip if the file contents is not ready to be read.
     *
     * @param context A {@link Context} to be used for resolving content URI in
     *                {@link FontInfo}.
     * @param fonts An array of {@link FontInfo}.
     * @return A map from {@link Uri} to {@link ByteBuffer}.
     * @hide
     */
A helper function to create a mapping from  Uri to  ByteBuffer.
Skip if the file contents is not ready to be read.

@param context A  Context to be used for resolving content URI in
FontInfo.
@param fonts An array of  FontInfo.
@return A map from  Uri to  ByteBuffer.
@hide
A helper function to create a mapping from Uri to ByteBuffer . Skip if the file contents is not ready to be read . @param context A Context to be used for resolving content URI in FontInfo . @param fonts An array of FontInfo . @return A map from Uri to ByteBuffer . @hide
@RestrictTo(LIBRARY_GROUP)
    @RequiresApi(19)
    public static Map<Uri, ByteBuffer> prepareFontData(Context context, FontInfo[] fonts,
            CancellationSignal cancellationSignal) {
        final HashMap<Uri, ByteBuffer> out = new HashMap<>();
        for (FontInfo font : fonts) {
            if (font.getResultCode() != Columns.RESULT_CODE_OK) {
                continue;
            }
            final Uri uri = font.getUri();
            if (out.containsKey(uri)) {
                continue;
            }
            ByteBuffer buffer = TypefaceCompatUtil.mmap(context, cancellationSignal, uri);
            out.put(uri, buffer);
        }
        return Collections.unmodifiableMap(out);
    }
@ RestrictTo ( LIBRARY_GROUP ) @ RequiresApi ( 19 ) public static Map < Uri , ByteBuffer > prepareFontData ( Context context , FontInfo [ ] fonts , CancellationSignal cancellationSignal ) { final HashMap < Uri , ByteBuffer > out = new HashMap < > ( ) ; for ( FontInfo font : fonts ) { if ( font . getResultCode ( ) != Columns . RESULT_CODE_OK ) { continue ; } final Uri uri = font . getUri ( ) ; if ( out . containsKey ( uri ) ) { continue ; } ByteBuffer buffer = TypefaceCompatUtil . mmap ( context , cancellationSignal , uri ) ; out . put ( uri , buffer ) ; } return Collections . unmodifiableMap ( out ) ; }
A helper function to create a mapping from {@link Uri} to {@link ByteBuffer}.
A helper function to create a mapping from { @link Uri } to { @link ByteBuffer } .