mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
sonarqube质量修复
This commit is contained in:
+4
-1
@@ -166,12 +166,14 @@ public class VoiceServiceImpl implements VoiceService{
|
||||
public void zipFiles(String fileNames, String zipOutName) throws IOException {
|
||||
WritableByteChannel writableByteChannel = null;
|
||||
ByteBuffer buffer = ByteBuffer.allocate(2048);
|
||||
FileInputStream fileInputStream = null;
|
||||
FileChannel fileChannel = null;
|
||||
try (ZipOutputStream zipOutputStream = new ZipOutputStream(new FileOutputStream(zipOutName))) {
|
||||
writableByteChannel = Channels.newChannel(zipOutputStream);
|
||||
File source = new File(fileNames);
|
||||
zipOutputStream.putNextEntry(new ZipEntry(source.getName()));
|
||||
fileChannel = new FileInputStream(fileNames).getChannel();
|
||||
fileInputStream = new FileInputStream(fileNames);
|
||||
fileChannel = fileInputStream.getChannel();
|
||||
while (fileChannel.read(buffer) != -1) {
|
||||
//更新缓存区位置
|
||||
buffer.flip();
|
||||
@@ -190,6 +192,7 @@ public class VoiceServiceImpl implements VoiceService{
|
||||
} finally {
|
||||
IOUtils.closeQuietly(writableByteChannel);
|
||||
IOUtils.closeQuietly(fileChannel);
|
||||
IOUtils.closeQuietly(fileInputStream);
|
||||
buffer.clear();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user