📄 filelist.java
字号:
package com.msd;
import java.util.List;
import java.util.LinkedList;
public class FileList {
private List filePool = null;
private static FileList instance = null;
private FileList() {
filePool = new LinkedList();
}
public synchronized static void create() {
if(instance == null)
instance = new FileList();
}
public static FileList getInstance() {
if(instance == null)
throw new NullPointerException("FileList is null");
return instance;
}
public void addFile(byte f,String n,byte[] a) {
synchronized(filePool) {
filePool.add(filePool.size(),new UpFile(f,n,a));
filePool.notifyAll();
}
}
public UpFile getFile() {
UpFile uf = null;
synchronized(filePool) {
while(filePool.isEmpty()) {
try{
filePool.wait();
} catch(InterruptedException e) { }
}
uf = (UpFile)filePool.remove(0);
}
return uf;
}
}
class UpFile {
byte flag;
String fileName;
byte[] arr;
UpFile(byte f,String n,byte[] a) {
flag = f;
fileName = n;
arr = a;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -