BAEL-4856 Remove BinaryFileDownloadApplication.java and use correct indentation
This commit is contained in:
@@ -7,28 +7,28 @@ import java.io.OutputStream;
|
||||
|
||||
public class BinaryFileWriter implements AutoCloseable {
|
||||
|
||||
private static final int CHUNK_SIZE = 1024;
|
||||
private final OutputStream outputStream;
|
||||
private static final int CHUNK_SIZE = 1024;
|
||||
private final OutputStream outputStream;
|
||||
|
||||
public BinaryFileWriter(OutputStream outputStream) {
|
||||
this.outputStream = outputStream;
|
||||
}
|
||||
|
||||
public long write(InputStream inputStream) throws IOException {
|
||||
try (BufferedInputStream input = new BufferedInputStream(inputStream)) {
|
||||
byte[] dataBuffer = new byte[CHUNK_SIZE];
|
||||
int readBytes;
|
||||
long totalBytes = 0;
|
||||
while ((readBytes = input.read(dataBuffer)) != -1) {
|
||||
totalBytes += readBytes;
|
||||
outputStream.write(dataBuffer, 0, readBytes);
|
||||
}
|
||||
return totalBytes;
|
||||
public BinaryFileWriter(OutputStream outputStream) {
|
||||
this.outputStream = outputStream;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
outputStream.close();
|
||||
}
|
||||
public long write(InputStream inputStream) throws IOException {
|
||||
try (BufferedInputStream input = new BufferedInputStream(inputStream)) {
|
||||
byte[] dataBuffer = new byte[CHUNK_SIZE];
|
||||
int readBytes;
|
||||
long totalBytes = 0;
|
||||
while ((readBytes = input.read(dataBuffer)) != -1) {
|
||||
totalBytes += readBytes;
|
||||
outputStream.write(dataBuffer, 0, readBytes);
|
||||
}
|
||||
return totalBytes;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
outputStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user