You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/12/08 16:15:41 UTC
[commons-compress] 10/38: Remove trailing whitespace
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit dd879752e8a448573a95dbd3462d4f0058095500
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Dec 8 11:05:06 2022 -0500
Remove trailing whitespace
---
.../lz4/BlockLZ4CompressorOutputStream.java | 26 +++++++++++-----------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorOutputStream.java b/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorOutputStream.java
index 61f0453e..1701eebc 100644
--- a/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorOutputStream.java
@@ -415,14 +415,14 @@ public class BlockLZ4CompressorOutputStream extends CompressorOutputStream {
private void prependLiteral(final byte[] data) {
literals.addFirst(data);
}
-
+
byte[] addLiteral(final LZ77Compressor.LiteralBlock block) {
final byte[] copy = Arrays.copyOfRange(block.getData(), block.getOffset(),
block.getOffset() + block.getLength());
literals.add(copy);
return copy;
}
-
+
void setBackReference(final LZ77Compressor.BackReference block) {
if (hasBackReference()) {
throw new IllegalStateException();
@@ -430,24 +430,24 @@ public class BlockLZ4CompressorOutputStream extends CompressorOutputStream {
brOffset = block.getOffset();
brLength = block.getLength();
}
-
+
boolean hasBackReference() {
return brOffset > 0;
}
-
+
boolean canBeWritten(final int lengthOfBlocksAfterThisPair) {
return hasBackReference()
&& lengthOfBlocksAfterThisPair >= MIN_OFFSET_OF_LAST_BACK_REFERENCE + MIN_BACK_REFERENCE_LENGTH;
}
-
+
int length() {
return literalLength() + brLength;
}
-
+
private boolean hasBeenWritten() {
return written;
}
-
+
void writeTo(final OutputStream out) throws IOException {
final int litLength = literalLength();
out.write(lengths(litLength, brLength));
@@ -466,17 +466,17 @@ public class BlockLZ4CompressorOutputStream extends CompressorOutputStream {
}
written = true;
}
-
+
private int literalLength() {
return literals.stream().mapToInt(b -> b.length).sum();
}
-
+
private static int lengths(final int litLength, final int brLength) {
final int l = Math.min(litLength, 15);
final int br = brLength < 4 ? 0 : (brLength < 19 ? brLength - 4 : 15);
return (l << BlockLZ4CompressorInputStream.SIZE_BITS) | br;
}
-
+
private static void writeLength(int length, final OutputStream out) throws IOException {
while (length >= 255) {
out.write(255);
@@ -484,18 +484,18 @@ public class BlockLZ4CompressorOutputStream extends CompressorOutputStream {
}
out.write(length);
}
-
+
private int backReferenceLength() {
return brLength;
}
-
+
private void prependTo(final Pair other) {
final Iterator<byte[]> listBackwards = literals.descendingIterator();
while (listBackwards.hasNext()) {
other.prependLiteral(listBackwards.next());
}
}
-
+
private Pair splitWithNewBackReferenceLengthOf(final int newBackReferenceLength) {
final Pair p = new Pair();
p.literals.addAll(literals);