remove BrutIO copy method

`copy` method already in IOUtils
This commit is contained in:
Rover12421
2015-03-30 13:30:52 +08:00
parent fc189e434b
commit 407ffdc5fe
2 changed files with 23 additions and 23 deletions

View File

@ -30,10 +30,8 @@ public class BrutIO {
try {
IOUtils.copy(in, out);
} finally {
try {
in.close();
out.close();
} catch (IOException ex) {}
IOUtils.closeQuietly(in);
IOUtils.closeQuietly(out);
}
}
@ -62,19 +60,14 @@ public class BrutIO {
return modified;
}
public static CRC32 calculateCrc(InputStream input, byte[] buffer) throws IOException {
public static CRC32 calculateCrc(InputStream input) throws IOException {
CRC32 crc = new CRC32();
int bytesRead = 0;
int bytesRead;
byte[] buffer = new byte[8192];
while((bytesRead = input.read(buffer)) != -1) {
crc.update(buffer, 0, bytesRead);
}
return crc;
}
public static void copy(InputStream input, OutputStream output, byte[] buffer) throws IOException {
int bytesRead;
while((bytesRead = input.read(buffer)) != -1) {
output.write(buffer, 0, bytesRead);
}
}
}