mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-26 01:05:38 +00:00
Resolve "Validator new feature: Pruefbericht Gesamtuebersicht bei Batch Verarbeitung"
This commit is contained in:
parent
c781316509
commit
e265667f25
31 changed files with 791 additions and 110 deletions
|
|
@ -52,7 +52,7 @@ public class SourceInput extends AbstractInput {
|
|||
}
|
||||
|
||||
private void validate() {
|
||||
if (!isHashcodeComputed() && !isSupported()) {
|
||||
if (!isHashcodeComputed() && isNotSupported()) {
|
||||
throw new IllegalStateException("Unsupported source. Only StreamSource supported yet");
|
||||
}
|
||||
if (!isHashcodeComputed() && ((StreamSource) this.source).getInputStream() == null) {
|
||||
|
|
@ -62,7 +62,7 @@ public class SourceInput extends AbstractInput {
|
|||
|
||||
@Override
|
||||
public Source getSource() throws IOException {
|
||||
if (!isHashcodeComputed() && !isSupported()) {
|
||||
if (!isHashcodeComputed() && isNotSupported()) {
|
||||
throw new IllegalStateException("Unsupported source. Only InputStream-based StreamSource supported yet");
|
||||
}
|
||||
if (isConsumed()) {
|
||||
|
|
@ -71,8 +71,8 @@ public class SourceInput extends AbstractInput {
|
|||
return isHashcodeComputed() ? this.source : wrappedSource();
|
||||
}
|
||||
|
||||
private boolean isSupported() {
|
||||
return isStreamSource();
|
||||
private boolean isNotSupported() {
|
||||
return !isStreamSource();
|
||||
}
|
||||
|
||||
private boolean isConsumed() throws IOException {
|
||||
|
|
@ -107,9 +107,7 @@ public class SourceInput extends AbstractInput {
|
|||
return result;
|
||||
}
|
||||
|
||||
private boolean isWrappingRequired() {
|
||||
return !isHashcodeComputed();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean supportsMultipleReads() {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ public class StreamHelper {
|
|||
* Helper class, which generates the hashcode while reading the stream e.g. for parsing the document. This allows
|
||||
* generating the hashcode without an aditional reading step.
|
||||
*/
|
||||
@SuppressWarnings("squid:S4929") // efficient read is done by internally used stream
|
||||
private static class DigestingInputStream extends FilterInputStream {
|
||||
|
||||
private final MessageDigest digest;
|
||||
|
|
@ -44,6 +45,7 @@ public class StreamHelper {
|
|||
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S4929") // efficient read is done by internally used stream
|
||||
private static class CountInputStream extends FilterInputStream {
|
||||
|
||||
private final LazyReadInput reference;
|
||||
|
|
@ -123,10 +125,12 @@ public class StreamHelper {
|
|||
* @param input the input
|
||||
* @throws IOException on I/O errors
|
||||
*/
|
||||
@SuppressWarnings("squid:S1854")
|
||||
public static void drain(final InputStream input) throws IOException {
|
||||
final byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
|
||||
|
||||
int n;
|
||||
|
||||
while (EOF != (n = input.read(buffer))) {
|
||||
// nothing
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue