Skip to content

Commit b56bfb5

Browse files
committed
Change to package private instead of protected
1 parent bc627ec commit b56bfb5

6 files changed

Lines changed: 27 additions & 27 deletions

File tree

src/main/java/org/apache/commons/compress/archivers/lha/LhaArchiveInputStream.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public LhaArchiveInputStream(final InputStream inputStream, final String charset
135135
* @param charsetName the charset used for file names in the archive. May be {@code null} to use US-ASCII as default.
136136
* @param fileSeparatorChar the character used to separate file path elements
137137
*/
138-
public LhaArchiveInputStream(final InputStream inputStream, final String charsetName, final char fileSeparatorChar) {
138+
LhaArchiveInputStream(final InputStream inputStream, final String charsetName, final char fileSeparatorChar) {
139139
super(inputStream, charsetName == null ? StandardCharsets.US_ASCII.name() : charsetName);
140140
this.fileSeparatorChar = fileSeparatorChar;
141141
}
@@ -212,7 +212,7 @@ public LhaArchiveEntry getNextEntry() throws IOException {
212212
* @return the next header entry, or null if there are no more entries
213213
* @throws IOException
214214
*/
215-
protected LhaArchiveEntry readHeader() throws IOException {
215+
LhaArchiveEntry readHeader() throws IOException {
216216
// Header level is not known yet. Read the minimum length header.
217217
final byte[] buffer = new byte[HEADER_GENERIC_MINIMUM_HEADER_LENGTH];
218218
final int len = IOUtils.read(in, buffer);
@@ -248,7 +248,7 @@ protected LhaArchiveEntry readHeader() throws IOException {
248248
* @return the LhaArchiveEntry read from the buffer
249249
* @throws IOException
250250
*/
251-
protected LhaArchiveEntry readHeaderLevel0(ByteBuffer buffer) throws IOException {
251+
LhaArchiveEntry readHeaderLevel0(ByteBuffer buffer) throws IOException {
252252
final int headerSize = Byte.toUnsignedInt(buffer.get(HEADER_LEVEL_0_OFFSET_HEADER_SIZE));
253253
if (headerSize < HEADER_GENERIC_MINIMUM_HEADER_LENGTH) {
254254
throw new ArchiveException("Invalid header level 0 length: %d", headerSize);
@@ -290,7 +290,7 @@ protected LhaArchiveEntry readHeaderLevel0(ByteBuffer buffer) throws IOException
290290
* @return the LhaArchiveEntry read from the buffer
291291
* @throws IOException
292292
*/
293-
protected LhaArchiveEntry readHeaderLevel1(ByteBuffer buffer) throws IOException {
293+
LhaArchiveEntry readHeaderLevel1(ByteBuffer buffer) throws IOException {
294294
final int baseHeaderSize = Byte.toUnsignedInt(buffer.get(HEADER_LEVEL_1_OFFSET_BASE_HEADER_SIZE));
295295
if (baseHeaderSize < HEADER_GENERIC_MINIMUM_HEADER_LENGTH) {
296296
throw new ArchiveException("Invalid header level 1 length: %d", baseHeaderSize);
@@ -360,7 +360,7 @@ protected LhaArchiveEntry readHeaderLevel1(ByteBuffer buffer) throws IOException
360360
* @return the LhaArchiveEntry read from the buffer
361361
* @throws IOException
362362
*/
363-
protected LhaArchiveEntry readHeaderLevel2(ByteBuffer buffer) throws IOException {
363+
LhaArchiveEntry readHeaderLevel2(ByteBuffer buffer) throws IOException {
364364
final int headerSize = Short.toUnsignedInt(buffer.getShort(HEADER_LEVEL_2_OFFSET_HEADER_SIZE));
365365
if (headerSize < HEADER_GENERIC_MINIMUM_HEADER_LENGTH) {
366366
throw new ArchiveException("Invalid header level 2 length: %d", headerSize);
@@ -414,7 +414,7 @@ protected LhaArchiveEntry readHeaderLevel2(ByteBuffer buffer) throws IOException
414414
* @return compression method, e.g. -lh5-
415415
* @throws ArchiveException if the compression method is invalid
416416
*/
417-
protected static String getCompressionMethod(final ByteBuffer buffer) throws ArchiveException {
417+
static String getCompressionMethod(final ByteBuffer buffer) throws ArchiveException {
418418
final byte[] compressionMethodBuffer = new byte[5];
419419
byteBufferGet(buffer, HEADER_GENERIC_OFFSET_COMPRESSION_METHOD, compressionMethodBuffer);
420420

@@ -445,7 +445,7 @@ protected static String getCompressionMethod(final ByteBuffer buffer) throws Arc
445445
* @param pathnameLength the length of the pathname
446446
* @return pathname
447447
*/
448-
protected String getPathname(final ByteBuffer buffer, final int pathnameLength) {
448+
String getPathname(final ByteBuffer buffer, final int pathnameLength) {
449449
final byte[] pathnameBuffer = new byte[pathnameLength];
450450
buffer.get(pathnameBuffer);
451451

@@ -525,7 +525,7 @@ private ByteBuffer readExtendedHeader(final int headerSize) throws IOException {
525525
* @param entryBuilder the entry builder to set the values in
526526
* @throws IOException
527527
*/
528-
protected void parseExtendedHeader(final ByteBuffer extendedHeaderBuffer, final LhaArchiveEntry.Builder entryBuilder) throws IOException {
528+
void parseExtendedHeader(final ByteBuffer extendedHeaderBuffer, final LhaArchiveEntry.Builder entryBuilder) throws IOException {
529529
final int extendedHeaderType = Byte.toUnsignedInt(extendedHeaderBuffer.get());
530530
if (extendedHeaderType == EXTENDED_HEADER_TYPE_COMMON) {
531531
// Common header

src/main/java/org/apache/commons/compress/compressors/lha/AbstractLhStaticHuffmanCompressorInputStream.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public void close() throws IOException {
101101
*
102102
* @return the copy threshold
103103
*/
104-
protected int getCopyThreshold() {
104+
int getCopyThreshold() {
105105
return 3;
106106
}
107107

@@ -110,14 +110,14 @@ protected int getCopyThreshold() {
110110
*
111111
* @return the number of bits used for the dictionary size
112112
*/
113-
protected abstract int getDictionaryBits();
113+
abstract int getDictionaryBits();
114114

115115
/**
116116
* Gets the size of the dictionary.
117117
*
118118
* @return the size of the dictionary
119119
*/
120-
protected int getDictionarySize() {
120+
int getDictionarySize() {
121121
return 1 << getDictionaryBits();
122122
}
123123

@@ -126,14 +126,14 @@ protected int getDictionarySize() {
126126
*
127127
* @return the number of bits used for the distance
128128
*/
129-
protected abstract int getDistanceBits();
129+
abstract int getDistanceBits();
130130

131131
/**
132132
* Gets the maximum number of distance codes in the distance tree.
133133
*
134134
* @return the maximum number of distance codes
135135
*/
136-
protected int getMaxNumberOfDistanceCodes() {
136+
int getMaxNumberOfDistanceCodes() {
137137
return getDictionaryBits() + 1;
138138
}
139139

@@ -142,7 +142,7 @@ protected int getMaxNumberOfDistanceCodes() {
142142
*
143143
* @return the maximum match length
144144
*/
145-
protected int getMaxMatchLength() {
145+
int getMaxMatchLength() {
146146
return 256;
147147
}
148148

@@ -152,7 +152,7 @@ protected int getMaxMatchLength() {
152152
*
153153
* @return the maximum number of commands
154154
*/
155-
protected int getMaxNumberOfCommands() {
155+
int getMaxNumberOfCommands() {
156156
return NUMBER_OF_LITERAL_CODES + getMaxMatchLength() - getCopyThreshold() + 1;
157157
}
158158

@@ -224,7 +224,7 @@ private void fillBuffer() throws IOException {
224224
* @return the command decoding tree
225225
* @throws IOException if an I/O error occurs
226226
*/
227-
protected BinaryTree readCommandDecodingTree() throws IOException {
227+
BinaryTree readCommandDecodingTree() throws IOException {
228228
// Number of code lengths to read
229229
final int numCodeLengths = readBits(COMMAND_DECODING_LENGTH_BITS);
230230

@@ -256,7 +256,7 @@ protected BinaryTree readCommandDecodingTree() throws IOException {
256256
* @return code length
257257
* @throws IOException if an I/O error occurs
258258
*/
259-
protected int readCodeLength() throws IOException {
259+
int readCodeLength() throws IOException {
260260
int len = readBits(CODE_LENGTH_BITS);
261261
if (len == 0x07) {
262262
int bit = bin.readBit();
@@ -283,7 +283,7 @@ protected int readCodeLength() throws IOException {
283283
* @return the command tree
284284
* @throws IOException if an I/O error occurs
285285
*/
286-
protected BinaryTree readCommandTree(final BinaryTree commandDecodingTree) throws IOException {
286+
BinaryTree readCommandTree(final BinaryTree commandDecodingTree) throws IOException {
287287
final int numCodeLengths = readBits(COMMAND_TREE_LENGTH_BITS);
288288

289289
if (numCodeLengths > getMaxNumberOfCommands()) {

src/main/java/org/apache/commons/compress/compressors/lha/Lh4CompressorInputStream.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ public Lh4CompressorInputStream(final InputStream in) throws IOException {
3333
}
3434

3535
@Override
36-
protected int getDictionaryBits() {
36+
int getDictionaryBits() {
3737
return 12;
3838
}
3939

4040
@Override
41-
protected int getDistanceBits() {
41+
int getDistanceBits() {
4242
return 4;
4343
}
4444

4545
@Override
46-
protected int getMaxNumberOfDistanceCodes() {
46+
int getMaxNumberOfDistanceCodes() {
4747
return getDictionaryBits() + 2;
4848
}
4949
}

src/main/java/org/apache/commons/compress/compressors/lha/Lh5CompressorInputStream.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ public Lh5CompressorInputStream(final InputStream in) throws IOException {
3333
}
3434

3535
@Override
36-
protected int getDictionaryBits() {
36+
int getDictionaryBits() {
3737
return 13;
3838
}
3939

4040
@Override
41-
protected int getDistanceBits() {
41+
int getDistanceBits() {
4242
return 4;
4343
}
4444
}

src/main/java/org/apache/commons/compress/compressors/lha/Lh6CompressorInputStream.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ public Lh6CompressorInputStream(final InputStream in) throws IOException {
3333
}
3434

3535
@Override
36-
protected int getDictionaryBits() {
36+
int getDictionaryBits() {
3737
return 15;
3838
}
3939

4040
@Override
41-
protected int getDistanceBits() {
41+
int getDistanceBits() {
4242
return 5;
4343
}
4444
}

src/main/java/org/apache/commons/compress/compressors/lha/Lh7CompressorInputStream.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ public Lh7CompressorInputStream(final InputStream in) throws IOException {
3333
}
3434

3535
@Override
36-
protected int getDictionaryBits() {
36+
int getDictionaryBits() {
3737
return 16;
3838
}
3939

4040
@Override
41-
protected int getDistanceBits() {
41+
int getDistanceBits() {
4242
return 5;
4343
}
4444
}

0 commit comments

Comments
 (0)