This commit is contained in:
Looly
2021-08-16 22:33:30 +08:00
parent f288c497b8
commit 3fe722554c
6 changed files with 84 additions and 34 deletions

View File

@@ -22,6 +22,9 @@ public class FastByteArrayOutputStream extends OutputStream {
private final FastByteBuffer buffer;
/**
* 构造
*/
public FastByteArrayOutputStream() {
this(1024);
}

View File

@@ -40,10 +40,13 @@ public class FastByteBuffer {
private final int minChunkLen;
public FastByteBuffer() {
this.minChunkLen = 1024;
this(1024);
}
public FastByteBuffer(int size) {
if(size <= 0){
size = 1024;
}
this.minChunkLen = Math.abs(size);
}
@@ -282,4 +285,4 @@ public class FastByteBuffer {
}
}
}
}

View File

@@ -102,7 +102,7 @@ public class IoUtil extends NioUtil {
* @return 传输的byte数
* @throws IORuntimeException IO异常
*/
public static long copy(Reader reader, Writer writer, int bufferSize, int count, StreamProgress streamProgress) throws IORuntimeException {
public static long copy(Reader reader, Writer writer, int bufferSize, long count, StreamProgress streamProgress) throws IORuntimeException {
return new ReaderWriterCopier(bufferSize, count, streamProgress).copy(reader, writer);
}
@@ -157,7 +157,7 @@ public class IoUtil extends NioUtil {
* @throws IORuntimeException IO异常
* @since 5.7.8
*/
public static long copy(InputStream in, OutputStream out, int bufferSize, int count, StreamProgress streamProgress) throws IORuntimeException {
public static long copy(InputStream in, OutputStream out, int bufferSize, long count, StreamProgress streamProgress) throws IORuntimeException {
return new StreamCopier(bufferSize, count, streamProgress).copy(in, out);
}