我已经为downloading Firebase Storage file to memory实现了以下代码。因此,下一步是我要访问文件。在这种情况下如何实现?
//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...");
}
});
您如何访问文件?默认情况下,您可以使用new ByteArrayOutputStream()
作为存储。https://stackoverflow.com/a/17595282/6916890