Skip to content

Commit

Permalink
feat: use ioutils.copy instead of low level buffer & bufferedInputStream
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolife999 committed Jan 24, 2025
1 parent 120f0bb commit 94437af
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.io.OutputStream;
import java.util.zip.GZIPOutputStream;

import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down Expand Up @@ -84,14 +85,9 @@ private static void exportParquet(OutputStream os, TableToRetrieve table, Client

File fileToTransfer = new File(ParquetDao.exportTablePath(table,clientDao.getParquetDirectory()));

try (FileInputStream fis = new FileInputStream(fileToTransfer);
BufferedInputStream bis = new BufferedInputStream(fis, CompressedUtils.READ_BUFFER_SIZE);)
try (FileInputStream fis = new FileInputStream(fileToTransfer);)
{
byte[] buffer = new byte[CompressedUtils.READ_BUFFER_SIZE];
int len;
while ((len = bis.read(buffer)) != -1) {
os.write(buffer, 0, len);
}
IOUtils.copy(fis, os, CompressedUtils.READ_BUFFER_SIZE);
} catch (FileNotFoundException e) {
throw new ArcException(e, ArcExceptionMessage.FILE_READ_FAILED, fileToTransfer);
} catch (IOException e) {
Expand Down

0 comments on commit 94437af

Please sign in to comment.