in commons-fileupload2-core/src/main/java/org/apache/commons/fileupload2/core/MultipartInput.java [671:697]
private MultipartInput(final InputStream input, final byte[] boundary, final int bufferSize, final ProgressNotifier notifier) {
if (boundary == null) {
throw new IllegalArgumentException("boundary may not be null");
}
// We prepend CR/LF to the boundary to chop trailing CR/LF from
// body-data tokens.
this.boundaryLength = boundary.length + BOUNDARY_PREFIX.length;
if (bufferSize < this.boundaryLength + 1) {
throw new IllegalArgumentException("The buffer size specified for the MultipartInput is too small");
}
this.input = input;
this.bufSize = Math.max(bufferSize, boundaryLength * 2);
this.buffer = new byte[this.bufSize];
this.notifier = notifier;
this.boundary = new byte[this.boundaryLength];
this.boundaryTable = new int[this.boundaryLength + 1];
this.keepRegion = this.boundary.length;
System.arraycopy(BOUNDARY_PREFIX, 0, this.boundary, 0, BOUNDARY_PREFIX.length);
System.arraycopy(boundary, 0, this.boundary, BOUNDARY_PREFIX.length, boundary.length);
computeBoundaryTable();
head = 0;
tail = 0;
}