- Changement size long by int

This commit is contained in:
Benjamin 2022-03-12 12:36:18 +01:00
parent 5fe63fa3ea
commit 7d55699f7b

View File

@ -12,19 +12,19 @@ public class FileReceiver {
public FileReceiver(String path) { this.path = path; } public FileReceiver(String path) { this.path = path; }
public boolean receiveFile(InputStream input, String fileName, long fileSize, String key, String iv) { public boolean receiveFile(InputStream input, String fileName, int fileSize, String key, String iv) {
int bytesReceived = 0; int bytesReceived = 0;
BufferedOutputStream bosFile = null; BufferedOutputStream bosFile = null;
try { try {
bosFile = new BufferedOutputStream(new FileOutputStream(String.format("%s/%s", path, fileName))); bosFile = new BufferedOutputStream(new FileOutputStream(String.format("%s/%s", path, fileName)));
//AES_GCM.encryptStream(input, bosFile, fileSize, key, iv); AES_GCM.encryptStream(input, bosFile, fileSize, key, iv);
bosFile.flush(); bosFile.flush();
bosFile.close(); bosFile.close();
return true; return true;
} catch(IOException ex) { } catch(IOException | AES_GCM.AesGcmException ex) {
ex.printStackTrace(); ex.printStackTrace();
if(bosFile != null) { try { bosFile.close(); } catch(Exception e) {} } if(bosFile != null) { try { bosFile.close(); } catch(Exception e) {} }
return false; return false;