[ipv6][Feat]讯飞语音合成升级成离线版
This commit is contained in:
@@ -24,6 +24,8 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.URL;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.security.DigestInputStream;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
@@ -1818,6 +1820,26 @@ public final class FileUtils {
|
||||
}).start();
|
||||
}
|
||||
|
||||
public static void writeFile(String path, byte[] bytes) {
|
||||
boolean append = false;
|
||||
try {
|
||||
File file = new File(path);
|
||||
if (file.exists()) {
|
||||
append = true;
|
||||
}else {
|
||||
file.createNewFile();
|
||||
}
|
||||
FileOutputStream out = new FileOutputStream(path,true);//指定写到哪个路径中
|
||||
FileChannel fileChannel = out.getChannel();
|
||||
fileChannel.write(ByteBuffer.wrap(bytes)); //将字节流写入文件中
|
||||
fileChannel.force(true);//强制刷新
|
||||
fileChannel.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件拷贝监听
|
||||
|
||||
Reference in New Issue
Block a user