Skip to content

Commit

Permalink
兼容安卓版本. at 2022-10-09 14:24:03
Browse files Browse the repository at this point in the history
  • Loading branch information
hhhaiai committed Oct 9, 2022
1 parent 7089087 commit b6e59d5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
22 changes: 10 additions & 12 deletions src/main/java/ff/jnezha/jnt/utils/FileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import java.util.Arrays;
import java.util.List;

import javax.swing.filechooser.FileSystemView;

/**
* Copyright © 2020 sanbo Inc. All rights reserved.
* Description: 文件读写类
Expand All @@ -15,16 +13,16 @@
* Author: sanbo
*/
public class FileUtils {
public static String getDestopFilePath(String fileName) {
FileSystemView fsv = FileSystemView.getFileSystemView();
File home = fsv.getHomeDirectory();
if (home.getAbsolutePath().endsWith("Desktop")) {
return new File(home, fileName).getAbsolutePath();
} else {
File desktop = new File(home, "Desktop");
return new File(desktop, fileName).getAbsolutePath();
}
}
// public static String getDestopFilePath(String fileName) {
// FileSystemView fsv = FileSystemView.getFileSystemView();
// File home = fsv.getHomeDirectory();
// if (home.getAbsolutePath().endsWith("Desktop")) {
// return new File(home, fileName).getAbsolutePath();
// } else {
// File desktop = new File(home, "Desktop");
// return new File(desktop, fileName).getAbsolutePath();
// }
// }

/**
* 读取文件内容,将文件内容读取成直接字节数组
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/ff/jnezha/jnt/utils/JdkBase64.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.nio.charset.Charset;
import java.util.Arrays;

/**
Expand Down Expand Up @@ -90,6 +90,7 @@ public class JdkBase64 {

private JdkBase64() {
}

/**
* Returns a {@link Encoder} that encodes using the
* <a href="#basic">Basic</a> type base64 encoding scheme.
Expand Down Expand Up @@ -573,7 +574,7 @@ public byte[] decode(byte[] src) {
* if {@code src} is not in valid Base64 scheme
*/
public byte[] decode(String src) {
return decode(src.getBytes(StandardCharsets.ISO_8859_1));
return decode(src.getBytes(Charset.forName("ISO-8859-1")));
}

/**
Expand Down

0 comments on commit b6e59d5

Please sign in to comment.