InflaterInputStream.java: New stub class.
� * 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. From-SVN: r26795
This commit is contained in:
parent
f7f65c793e
commit
0ec3c5478a
2 changed files with 152 additions and 6 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue