Use content resolver openInputStream

pull/187/head
M66B 4 years ago
parent f9a4c92b51
commit df8ecb3882

@ -23,7 +23,6 @@ import android.Manifest;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetFileDescriptor;
import android.net.Uri;
import android.os.Bundle;
import android.text.Spanned;
@ -101,8 +100,7 @@ public class ActivityDSN extends ActivityBase {
Result result = new Result();
ContentResolver resolver = context.getContentResolver();
AssetFileDescriptor descriptor = resolver.openTypedAssetFileDescriptor(uri, "*/*", null);
try (InputStream is = descriptor.createInputStream()) {
try (InputStream is = resolver.openInputStream(uri)) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] buffer = new byte[Helper.BUFFER_SIZE];
int length;

@ -24,7 +24,6 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.AssetFileDescriptor;
import android.net.Uri;
import android.os.Bundle;
import android.text.Spanned;
@ -158,8 +157,7 @@ public class ActivityEML extends ActivityBase {
Result result = new Result();
ContentResolver resolver = context.getContentResolver();
AssetFileDescriptor descriptor = resolver.openTypedAssetFileDescriptor(uri, "*/*", null);
try (InputStream is = descriptor.createInputStream()) {
try (InputStream is = resolver.openInputStream(uri)) {
Properties props = MessageHelper.getSessionProperties();
Session isession = Session.getInstance(props, null);
@ -406,8 +404,7 @@ public class ActivityEML extends ActivityBase {
throw new IllegalArgumentException(context.getString(R.string.title_no_folder));
ContentResolver resolver = context.getContentResolver();
AssetFileDescriptor descriptor = resolver.openTypedAssetFileDescriptor(uri, "*/*", null);
try (InputStream is = descriptor.createInputStream()) {
try (InputStream is = resolver.openInputStream(uri)) {
Properties props = MessageHelper.getSessionProperties();
Session isession = Session.getInstance(props, null);

@ -32,7 +32,6 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.res.AssetFileDescriptor;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@ -704,8 +703,7 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
StringBuilder data = new StringBuilder();
Log.i("Reading URI=" + uri);
ContentResolver resolver = context.getContentResolver();
AssetFileDescriptor descriptor = resolver.openTypedAssetFileDescriptor(uri, "*/*", null);
try (InputStream raw = new BufferedInputStream(descriptor.createInputStream())) {
try (InputStream raw = new BufferedInputStream(resolver.openInputStream(uri))) {
InputStream in;
if (TextUtils.isEmpty(password))

@ -23,7 +23,6 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.AssetFileDescriptor;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
@ -386,8 +385,7 @@ public class FragmentRules extends FragmentBase {
Log.i("Reading URI=" + uri);
ContentResolver resolver = context.getContentResolver();
AssetFileDescriptor descriptor = resolver.openTypedAssetFileDescriptor(uri, "*/*", null);
try (InputStream is = descriptor.createInputStream()) {
try (InputStream is = resolver.openInputStream(uri)) {
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
String line;
while ((line = reader.readLine()) != null)

Loading…
Cancel
Save