blob: 18f4d388652e001625c38791e2a457df2a565013 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
/* Copyright (C) 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.util.zip;
import java.io.*;
/** JUST AN INCOMPLETE STUB! */
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);
}
}
|