📄 fileheader.java
字号:
package org.galaxy_OPEN.www.datastructures.huffman;
import java.io.*;
public class FileHeader implements Serializable {
private String originalFileName;
private long numBytes;
private Node huffmanTree;
public FileHeader(String name, long nbBytes, Node huffTree) {
originalFileName = name;
numBytes = nbBytes;
this.huffmanTree = huffTree;
}
public String getOriginalFileName() {
return originalFileName;
}
public long getNumBytes() {
return numBytes;
}
public Node getHuffmanTree() {
return huffmanTree;
}
public long headerLength() throws FileNotFoundException, IOException {
long size = -1;
File temp = File.createTempFile("header", ".tmp");
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(
temp));
oos.writeObject(this);
oos.flush();
oos.close();
size = temp.length();
temp.delete();
return size;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -