niagara-ax/modules/cfr_output/com/ice/tar/TarGzOutputStream.java
2026-03-17 13:31:18 -07:00

108 lines
2.7 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package com.ice.tar;
import com.ice.tar.TarEntry;
import com.ice.tar.TarOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.zip.GZIPOutputStream;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class TarGzOutputStream
extends TarOutputStream {
private TarOutputStream tos;
private GZIPOutputStream gzip;
private ByteArrayOutputStream bos;
private TarEntry currentEntry;
public void setDebug(boolean bl) {
this.tos.setDebug(bl);
}
public void setBufferDebug(boolean bl) {
this.tos.setBufferDebug(bl);
}
public void finish() throws IOException {
if (this.currentEntry != null) {
this.closeEntry();
}
this.tos.finish();
}
public void close() throws IOException {
this.tos.close();
this.gzip.finish();
}
public int getRecordSize() {
return this.tos.getRecordSize();
}
public void putNextEntry(TarEntry tarEntry) throws IOException {
if (tarEntry.getSize() != 0L) {
this.tos.putNextEntry(tarEntry);
} else {
this.currentEntry = tarEntry;
}
}
public void closeEntry() throws IOException {
if (this.currentEntry == null) {
this.tos.closeEntry();
} else {
this.currentEntry.setSize(this.bos.size());
this.tos.putNextEntry(this.currentEntry);
this.bos.writeTo(this.tos);
this.tos.closeEntry();
this.currentEntry = null;
this.bos = new ByteArrayOutputStream();
}
}
public void write(int n) throws IOException {
if (this.currentEntry == null) {
this.tos.write(n);
} else {
this.bos.write(n);
}
}
public void write(byte[] byArray) throws IOException {
if (this.currentEntry == null) {
this.tos.write(byArray);
} else {
this.bos.write(byArray);
}
}
public void write(byte[] byArray, int n, int n2) throws IOException {
if (this.currentEntry == null) {
this.tos.write(byArray, n, n2);
} else {
this.bos.write(byArray, n, n2);
}
}
private final /* synthetic */ void this() {
this.tos = null;
this.gzip = null;
this.bos = null;
this.currentEntry = null;
}
public TarGzOutputStream(OutputStream outputStream) throws IOException {
super(null);
this.this();
this.gzip = new GZIPOutputStream(outputStream);
this.tos = new TarOutputStream(this.gzip);
this.bos = new ByteArrayOutputStream();
}
}