mirror of
https://github.com/apache/cordova-android.git
synced 2025-03-01 14:33:00 +08:00
refactor: use StandardCharsets and remove redundant try-catch
This commit is contained in:
parent
9afd540ca8
commit
02ddf2ef62
@ -40,6 +40,7 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Locale;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
@ -447,11 +448,7 @@ public class CordovaResourceApi {
|
||||
if (base64) {
|
||||
data = Base64.decode(dataPartAsString, Base64.DEFAULT);
|
||||
} else {
|
||||
try {
|
||||
data = dataPartAsString.getBytes("UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
data = dataPartAsString.getBytes();
|
||||
}
|
||||
data = dataPartAsString.getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
InputStream inputStream = new ByteArrayInputStream(data);
|
||||
return new OpenForReadResult(uri, inputStream, contentType, data.length, null);
|
||||
|
Loading…
Reference in New Issue
Block a user