📄 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(SendFile fileName) {
synchronized(filePool) {
filePool.add(filePool.size(),fileName);
filePool.notifyAll();
}
}
public SendFile getFile() {
SendFile fileName = null;
synchronized(filePool) {
while(filePool.isEmpty()) {
try{
filePool.wait();
} catch(InterruptedException e) { }
}
fileName = (SendFile)filePool.remove(0);
}
return fileName;
}
}
class SendFile {
String fileName;
int flag;
public SendFile(String f,int g) {
fileName = f;
flag = g;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -