summaryrefslogtreecommitdiffstats
path: root/libjava/java/util/zip/ZipOutputStream.java
diff options
context:
space:
mode:
authorbothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4>1999-05-06 00:15:47 +0000
committerbothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4>1999-05-06 00:15:47 +0000
commitd27a9520e6c954a6024c163bbe1d083e16c22c20 (patch)
tree575a1cf180a50acdf7addeef236bbe8d1a6a7f74 /libjava/java/util/zip/ZipOutputStream.java
parenta0c1e5d987f3f4ca4465d6f4549b4e207768b706 (diff)
downloadppe42-gcc-d27a9520e6c954a6024c163bbe1d083e16c22c20.tar.gz
ppe42-gcc-d27a9520e6c954a6024c163bbe1d083e16c22c20.zip
* InflaterInputStream.java: New stub class. * ZipInputStream.java: New class. Partly works. * ZipConstants.java: Add two (internal) constants. * ZipEntry.java (timeFromDOS): New static (non-public) method. * ZipFile.java: Make it mostly work, except for compression. * ZipOutputStream.java: Start implementation. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26795 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/util/zip/ZipOutputStream.java')
-rw-r--r--libjava/java/util/zip/ZipOutputStream.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/libjava/java/util/zip/ZipOutputStream.java b/libjava/java/util/zip/ZipOutputStream.java
index 42cfb00169e..18f4d388652 100644
--- a/libjava/java/util/zip/ZipOutputStream.java
+++ b/libjava/java/util/zip/ZipOutputStream.java
@@ -14,13 +14,60 @@ import java.io.*;
public class ZipOutputStream extends DeflaterOutputStream
implements ZipConstants
{
+ ZipEntry current;
+ int method = DEFLATED;
+ int level = 3; // FIXME - should be DEFAULT_COMPRESSION
+ String comment;
+
+ public static final int STORED = 0;
+ public static final int DEFLATED = 8;
+
public ZipOutputStream (OutputStream out)
{
super(out);
}
+ public void setLevel (int level) { this.level = level; }
+ public void setMethod (int method) { this.method = method; }
+ public void setComment(String comment) { this.comment = comment; }
+
public void putNextEntry (ZipEntry entry) throws IOException
{
+ put4(0x04034b50);
+ put2(0); // version - FIXME
+ put2(0); // bits - FIXME
+ if (entry.method < 0 )
+ entry.method = method;
+ put2(entry.method);
+ put2(0); // time - FIXME
+ put2(0); // date - FIXME
+ put4((int) entry.crc);
+ put4((int) entry.compressedSize); // FIXME
+ put4((int) entry.size); // FIXME
+ put2(entry.name.length());
+ put2(entry.extra == null ? 0 : entry.extra.length);
+ byte[] name = entry.name.getBytes("8859_1");
+ out.write(name);
+ if (entry.extra != null)
+ out.write(entry.extra);
throw new Error ("java.util.zip.ZipOutputStream.putNextEntry: not implemented");
}
+
+ public void closeEntry () throws IOException
+ {
+ }
+
+ private void put2 (int i) throws IOException
+ {
+ out.write (i);
+ out.write (i >> 8);
+ }
+
+ private void put4 (int i) throws IOException
+ {
+ out.write (i);
+ out.write (i >> 8);
+ out.write (i >> 16);
+ out.write (i >> 24);
+ }
}
OpenPOWER on IntegriCloud