- 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 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;
BufferedOutputStream bosFile = null;
try {
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.close();
return true;
} catch(IOException ex) {
} catch(IOException | AES_GCM.AesGcmException ex) {
ex.printStackTrace();
if(bosFile != null) { try { bosFile.close(); } catch(Exception e) {} }
return false;