首页 > 解决方案 > Firebase下载到内存后如何访问文件?

问题描述

我已经实现了以下代码,用于将 Firebase 存储文件下载到内存。因此,下一步是我要访问该文件。在这种情况下,我怎样才能做到这一点?

 //Download to memory
    public void downloadToMemory(StorageReference sRefChild, String selectedFile)
{

    final long ONE_MEGABYTE = 1024 * 1024 *5;
    sRefChild.getBytes(ONE_MEGABYTE).addOnSuccessListener(new OnSuccessListener<byte[]>() {
        @Override
        public void onSuccess(byte[] bytes) {
            System.out.println("On success!");

        }
    }).addOnFailureListener(new OnFailureListener() {
        @Override
        public void onFailure(@NonNull Exception exception) {
            // Handle any errors
            System.out.println("Handle failure...");
        }
    });

标签: javafirebasedownloadgoogle-cloud-storagefirebase-storage

解决方案


您想如何访问该文件?默认情况下,您可以new ByteArrayOutputStream()用作存储。 https://stackoverflow.com/a/17595282/6916890


推荐阅读