📄 zarchive.java
字号:
/*
* Copyright 2002 EZCell , Inc. All rights reserved.
* Version 1.0.
* Author W.John
*/
package ezcell;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.StreamCorruptedException;
/**
* put your documentation comment here
*/
class ObjectInputStream2 extends ObjectInputStream {
public ZDefaultBook book;
public ZDefaultSheet sheet;
/**
* put your documentation comment here
* @param ZDefaultSheet sheet
* @param InputStream is
*/
public ObjectInputStream2(ZDefaultSheet sheet, InputStream is)
throws IOException, StreamCorruptedException {
super(is);
this.sheet = sheet;
}
/**
* put your documentation comment here
* @param ZDefaultBook book
* @param InputStream is
*/
public ObjectInputStream2(ZDefaultBook book, InputStream is)
throws IOException, StreamCorruptedException {
super(is);
this.book = book;
}
/**
* put your documentation comment here
* @param InputStream is
*/
public ObjectInputStream2(InputStream is) throws IOException, StreamCorruptedException {
super(is);
}
}
/**
* put your documentation comment here
*/
public class ZArchive {
private byte[] buffer;
private ByteArrayOutputStream os = new ByteArrayOutputStream(100);
public ObjectOutputStream out;
private ByteArrayInputStream is;
public ObjectInputStream2 in;
private ZDefaultSheet sheet;
/**
* put your documentation comment here
* @param ZDefaultSheet sheet
*/
ZArchive(ZDefaultSheet sheet) {
this.sheet = sheet;
try {
out = new ObjectOutputStream(os);
} catch (Exception e) {
}
}
/**
* put your documentation comment here
* @param sheet
*/
public void setSheet(ZDefaultSheet sheet) {
this.sheet = sheet;
}
/**
* put your documentation comment here
* @return
*/
public ZDefaultSheet getSheet() {
return sheet;
}
/**
* put your documentation comment here
* @exception IOException
*/
public void createInputStream() throws IOException {
is = new ByteArrayInputStream(buffer);
in = new ObjectInputStream2(sheet, is);
}
/**
* put your documentation comment here
*/
public void flush() throws IOException {
out.close();
buffer = os.toByteArray();
}
/**
* put your documentation comment here
* @return
*/
public ZBase readObject() {
ZBase result = null;
try {
switch (in.readInt()) {
case ZBase.CELL:
result = new ZDefaultCell(sheet);
break;
case ZBase.ROW:
result = new ZRow(sheet);
break;
case ZBase.COLUMN:
result = new ZCol(sheet);
break;
}
//result.loadFromStream(in);
} catch (IOException ioe) {
}
return result;
}
/**
* put your documentation comment here
* @param obj
* @param prop
*/
public void writeObject(ZBase obj, int prop) {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -