Skip to content

Commit

Permalink
Better internal class name
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Aug 18, 2023
1 parent ed6c8fe commit 2f224e2
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
* @ThreadSafe
* @since 1.3
*/
abstract class StreamBridge extends FilterOutputStream {
abstract class AbstractStreamBridge extends FilterOutputStream {
private InputStream input;
private final Object inputLock = new Object();

protected StreamBridge() {
protected AbstractStreamBridge() {
this(null);
}

protected StreamBridge(final OutputStream out) {
protected AbstractStreamBridge(final OutputStream out) {
super(out);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*
* @since 1.3
*/
class InMemoryCachingStreamBridge extends StreamBridge {
class InMemoryCachingStreamBridge extends AbstractStreamBridge {

InMemoryCachingStreamBridge() {
super(new ByteArrayOutputStream());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static boolean matches(final byte[] signature, final int length) {

private final InputStream originalInput;

private final StreamBridge streamBridge;
private final AbstractStreamBridge abstractStreamBridge;

/**
* Decompresses the given file, caching the decompressed data in
Expand Down Expand Up @@ -150,8 +150,8 @@ private Pack200CompressorInputStream(final InputStream in, final File f,
final Map<String, String> props)
throws IOException {
originalInput = in;
streamBridge = mode.newStreamBridge();
try (final JarOutputStream jarOut = new JarOutputStream(streamBridge)) {
abstractStreamBridge = mode.newStreamBridge();
try (final JarOutputStream jarOut = new JarOutputStream(abstractStreamBridge)) {
final Pack200.Unpacker u = Pack200.newUnpacker();
if (props != null) {
u.properties().putAll(props);
Expand Down Expand Up @@ -223,13 +223,13 @@ public Pack200CompressorInputStream(final InputStream in,

@Override
public int available() throws IOException {
return streamBridge.getInput().available();
return abstractStreamBridge.getInput().available();
}

@Override
public void close() throws IOException {
try {
streamBridge.stop();
abstractStreamBridge.stop();
} finally {
if (originalInput != null) {
originalInput.close();
Expand All @@ -240,7 +240,7 @@ public void close() throws IOException {
@Override
public synchronized void mark(final int limit) {
try {
streamBridge.getInput().mark(limit);
abstractStreamBridge.getInput().mark(limit);
} catch (final IOException ex) {
throw new UncheckedIOException(ex); //NOSONAR
}
Expand All @@ -249,33 +249,33 @@ public synchronized void mark(final int limit) {
@Override
public boolean markSupported() {
try {
return streamBridge.getInput().markSupported();
return abstractStreamBridge.getInput().markSupported();
} catch (final IOException ex) { // NOSONAR
return false;
}
}

@Override
public int read() throws IOException {
return streamBridge.getInput().read();
return abstractStreamBridge.getInput().read();
}

@Override
public int read(final byte[] b) throws IOException {
return streamBridge.getInput().read(b);
return abstractStreamBridge.getInput().read(b);
}

@Override
public int read(final byte[] b, final int off, final int count) throws IOException {
return streamBridge.getInput().read(b, off, count);
return abstractStreamBridge.getInput().read(b, off, count);
}
@Override
public synchronized void reset() throws IOException {
streamBridge.getInput().reset();
abstractStreamBridge.getInput().reset();
}

@Override
public long skip(final long count) throws IOException {
return IOUtils.skip(streamBridge.getInput(), count);
return IOUtils.skip(abstractStreamBridge.getInput(), count);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
public class Pack200CompressorOutputStream extends CompressorOutputStream {
private boolean finished;
private final OutputStream originalOutput;
private final StreamBridge streamBridge;
private final AbstractStreamBridge abstractStreamBridge;
private final Map<String, String> properties;

/**
Expand Down Expand Up @@ -93,7 +93,7 @@ public Pack200CompressorOutputStream(final OutputStream out,
final Map<String, String> props)
throws IOException {
originalOutput = out;
streamBridge = mode.newStreamBridge();
abstractStreamBridge = mode.newStreamBridge();
properties = props;
}

Expand All @@ -103,7 +103,7 @@ public void close() throws IOException {
finish();
} finally {
try {
streamBridge.stop();
abstractStreamBridge.stop();
} finally {
originalOutput.close();
}
Expand All @@ -117,24 +117,24 @@ public void finish() throws IOException {
if (properties != null) {
p.properties().putAll(properties);
}
try (JarInputStream ji = new JarInputStream(streamBridge.getInput())) {
try (JarInputStream ji = new JarInputStream(abstractStreamBridge.getInput())) {
p.pack(ji, originalOutput);
}
}
}

@Override
public void write(final byte[] b) throws IOException {
streamBridge.write(b);
abstractStreamBridge.write(b);
}

@Override
public void write(final byte[] b, final int from, final int length) throws IOException {
streamBridge.write(b, from, length);
abstractStreamBridge.write(b, from, length);
}

@Override
public void write(final int b) throws IOException {
streamBridge.write(b);
abstractStreamBridge.write(b);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ public enum Pack200Strategy {
/** Cache output in memory */
IN_MEMORY() {
@Override
StreamBridge newStreamBridge() {
AbstractStreamBridge newStreamBridge() {
return new InMemoryCachingStreamBridge();
}
},
/** Cache output in a temporary file */
TEMP_FILE() {
@Override
StreamBridge newStreamBridge() throws IOException {
AbstractStreamBridge newStreamBridge() throws IOException {
return new TempFileCachingStreamBridge();
}
};

abstract StreamBridge newStreamBridge() throws IOException;
abstract AbstractStreamBridge newStreamBridge() throws IOException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*
* @since 1.3
*/
class TempFileCachingStreamBridge extends StreamBridge {
class TempFileCachingStreamBridge extends AbstractStreamBridge {
private final Path f;

TempFileCachingStreamBridge() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@
*/
public class NewAttribute extends BCIRenumberedAttribute {

private static class BCIndex extends BCValue {
private static class BCIndex extends AbstractBcValue {

private final int index;

public BCIndex(final int index) {
this.index = index;
}
}
private static class BCLength extends BCValue {
private static class BCLength extends AbstractBcValue {

private final int length;

public BCLength(final int length) {
this.length = length;
}
}
private static class BCOffset extends BCValue {
private static class BCOffset extends AbstractBcValue {

private final int offset;
private int index;
Expand All @@ -57,7 +57,7 @@ public void setIndex(final int index) {

}
// Bytecode-related value (either a bytecode index or a length)
private static abstract class BCValue {
private static abstract class AbstractBcValue {

int actualValue;

Expand Down Expand Up @@ -221,8 +221,8 @@ protected void writeBody(final DataOutputStream dos) throws IOException {
value = ((Long) obj).longValue();
} else if (obj instanceof ClassFileEntry) {
value = pool.indexOf(((ClassFileEntry) obj));
} else if (obj instanceof BCValue) {
value = ((BCValue) obj).actualValue;
} else if (obj instanceof AbstractBcValue) {
value = ((AbstractBcValue) obj).actualValue;
}
// Write
switch (length) {
Expand Down

0 comments on commit 2f224e2

Please sign in to comment.