📄 bookfileimpl.java
字号:
/********************************************************************
*
* 版权说明,此程序仅供学习参考。不能用于商业
*
********************************************************************/
package org.pook.file;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;
import javax.microedition.io.Connector;
import javax.microedition.io.file.FileConnection;
import javax.microedition.io.file.FileSystemRegistry;
import org.pook.log.Log;
import org.pook.model.File;
/**
* <b>类名:BookFileImpl.java</b> </br>
* 编写日期: 2006-10-12 <br/>
* 程序功能描述: <br/>
* Demo: <br/>
* Bug: <br/>
*
* 程序变更日期 :<br/>
* 变更作者 :<br/>
* 变更说明 :<br/>
*
* @author wuhua </br> <a href="mailto:rrq12345@163.com">rrq12345@163.com</a>
*/
public class BookFileImpl implements BookFile {
private static Log log = Log.getLog("BookFileImpl");
FileConnection conn = null;
BookFileImpl(String url)throws Exception{
conn = (FileConnection) Connector.open( url, Connector.READ);
}
public Vector listName() throws IOException {
Vector vc = null;
if( conn.isDirectory() ){
Enumeration names = conn.list();
vc = new Vector();
while( names.hasMoreElements() ){
//setFileImpl(vc, (String) names.nextElement());
vc.addElement(names.nextElement());
}
return vc;
} else {
return null;
}
}
public boolean isFile() {
conn.exists();
if(conn.isDirectory())
return false;
else
return true;
}
public void close() {
if(conn != null)
try {
conn.close();
} catch (IOException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
public File openFile() {
System.out.println(conn.getURL());
File f = new File(conn.getURL(),conn.getPath(),conn.getName(),null);
return f;
}
public boolean exists() {
return conn.exists();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -