Removed extends Node & Added some docs
This commit is contained in:
1 parent
65d2cea7ba
commit
73393c656e
6 files changed
+55
-16
No files matched your search
@@ -1,27 +1,73 @@
|
||||
import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* {@link BZip2} itself is an implementation of {@link InputStream} to feed the header magic to a {@link BZip2CompressorInputStream}.
|
||||
*
|
||||
* @see #decompress(byte[], int, int, byte[])
|
||||
*/
|
||||
public class BZip2 extends InputStream {
|
||||
|
||||
private static final byte[] MAGIC = {'B', 'Z', 'h', '1'};
|
||||
|
||||
public static void decompress(byte[] dst, byte[] src, int srcOff, int srcLen) throws IOException {
|
||||
BZip2CompressorInputStream bz2in = new BZip2CompressorInputStream(new BZip2(src, srcOff, srcLen));
|
||||
/**
|
||||
* Decompresses the source.
|
||||
*
|
||||
* @param src the source data.
|
||||
* @param off the source offset.
|
||||
* @param len the source length.
|
||||
* @param dst the destination or <code>null</code> to create a new one.
|
||||
* @throws IOException if the stream content is malformed or an I/O error occurs.
|
||||
*/
|
||||
public static byte[] decompress(byte[] src, int off, int len, byte[] dst) throws IOException {
|
||||
ByteArrayOutputStream tmp = null;
|
||||
|
||||
if (dst == null) {
|
||||
tmp = new ByteArrayOutputStream();
|
||||
}
|
||||
|
||||
BZip2CompressorInputStream in = new BZip2CompressorInputStream(new BZip2(src, off, len));
|
||||
|
||||
byte[] buf = new byte[2048];
|
||||
int read;
|
||||
int written = 0;
|
||||
while ((read = bz2in.read(buf)) != -1) {
|
||||
System.arraycopy(buf, 0, dst, written, read);
|
||||
|
||||
while ((read = in.read(buf)) != -1) {
|
||||
if (tmp != null) {
|
||||
tmp.write(buf, 0, read);
|
||||
} else {
|
||||
System.arraycopy(buf, 0, dst, written, read);
|
||||
}
|
||||
written += read;
|
||||
}
|
||||
|
||||
if (tmp != null) {
|
||||
return tmp.toByteArray();
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
/**
|
||||
* The input.
|
||||
*/
|
||||
private final ByteArrayInputStream in;
|
||||
/**
|
||||
* The position.
|
||||
*/
|
||||
private int position;
|
||||
|
||||
/**
|
||||
* Constructs a new helper class to fool that silly compressor.
|
||||
*
|
||||
* @param src the source.
|
||||
* @param off the source offset.
|
||||
* @param len the source length.
|
||||
*/
|
||||
private BZip2(byte[] src, int off, int len) {
|
||||
this.in = new ByteArrayInputStream(src, off, len);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Draw2D extends DoublyLinkedList.Node {
|
||||
public class Draw2D {
|
||||
|
||||
public static int[] pixels;
|
||||
public static int width;
|
||||
|
||||
@@ -25,7 +25,7 @@ public class FileArchive {
|
||||
|
||||
if (packedSize != unpackedSize) {
|
||||
data = new byte[unpackedSize];
|
||||
BZip2.decompress(data, src, 6, packedSize);
|
||||
BZip2.decompress(src, 6, packedSize, data);
|
||||
buffer = new Buffer(data);
|
||||
unpacked = true;
|
||||
} else {
|
||||
@@ -65,7 +65,7 @@ public class FileArchive {
|
||||
byte[] dst = new byte[fileSizeInflated[file]];
|
||||
|
||||
if (!unpacked) {
|
||||
BZip2.decompress(dst, data, fileOffset[file], fileSizeDeflated[file]);
|
||||
BZip2.decompress(data, fileOffset[file], fileSizeDeflated[file], dst);
|
||||
} else {
|
||||
System.arraycopy(data, fileOffset[file], dst, 0, fileSizeInflated[file]);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
|
||||
// Jad home page: http://www.kpdus.com/jad.html
|
||||
// Decompiler options: packimports(3)
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.PixelGrabber;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Image24 extends Draw2D {
|
||||
public class Image24 extends DoublyLinkedList.Node {
|
||||
|
||||
public int[] anIntArray1439;
|
||||
public int anInt1440;
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
|
||||
// Jad home page: http://www.kpdus.com/jad.html
|
||||
// Decompiler options: packimports(3)
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class Image8 {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// Decompiler options: packimports(3)
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
|
||||
public class Scene {
|
||||
|
||||
|
||||
Reference in new issue
Block a user