F - 由该对象转发的文件对象的种类
public class ForwardingFileObject<F extends FileObject> extends Object implements FileObject
| Modifier and Type | Field and Description |
|---|---|
protected F |
fileObject
所有方法被委派的文件对象。
|
| Modifier | Constructor and Description |
|---|---|
protected |
ForwardingFileObject(F fileObject)
创建一个新的ForwardingFileObject实例。
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
delete()
删除此文件对象。
|
CharSequence |
getCharContent(boolean ignoreEncodingErrors)
获取此文件对象的字符内容(如果可用)。
|
long |
getLastModified()
获取上次修改此文件对象的时间。
|
String |
getName()
获取此文件对象的用户友好名称。
|
InputStream |
openInputStream()
获取此文件对象的InputStream。
|
OutputStream |
openOutputStream()
获取此文件对象的OutputStream。
|
Reader |
openReader(boolean ignoreEncodingErrors)
获取此对象的读者。
|
Writer |
openWriter()
获取此文件对象的Writer。
|
URI |
toUri()
返回标识此文件对象的URI。
|
protected final F extends FileObject fileObject
protected ForwardingFileObject(F fileObject)
fileObject - 委托给此文件对象
public URI toUri()
FileObject
toUri在接口
FileObject
public String getName()
FileObject复制
"BobsApp\Test.java" ,则此方法应返回"BobsApp\Test.java"而toUri方法可能返回file:///C:/Documents%20and%20Settings/UncleBob/BobsApp/Test.java 。
getName在接口
FileObject
public InputStream openInputStream() throws IOException
FileObject
openInputStream在接口
FileObject
IllegalStateException - 如果此文件对象被打开以供写入,并且不支持读取
UnsupportedOperationException - 如果这种文件对象不支持字节访问
IOException - 如果发生I / O错误
public OutputStream openOutputStream() throws IOException
FileObject
openOutputStream在界面
FileObject
IllegalStateException - 如果此文件对象被打开以供阅读,并且不支持写入
UnsupportedOperationException - 如果这种文件对象不支持字节访问
IOException - 如果发生I / O错误
public Reader openReader(boolean ignoreEncodingErrors) throws IOException
FileObject
ignoreEncodingErrors为真,否则读者可能会报告诊断。
openReader在接口
FileObject
ignoreEncodingErrors - 忽略编码错误,如果为true
IllegalStateException - 如果此文件对象被打开以供写入,并且不支持读取
UnsupportedOperationException - 如果这种文件对象不支持字符访问
IOException - 如果发生I / O错误
public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException
FileObject
ignoreEncodingErrors为真,否则可能会报告ignoreEncodingErrors 。
getCharContent在接口
FileObject
ignoreEncodingErrors - 忽略编码错误,如果为true
null否则
IllegalStateException - 如果这个文件对象被打开来写入并且不支持读取
UnsupportedOperationException - 如果这种文件对象不支持字符访问
IOException - 如果发生I / O错误
public Writer openWriter() throws IOException
FileObject
openWriter在界面
FileObject
IllegalStateException - 如果此文件对象被打开以供阅读,并且不支持写入
UnsupportedOperationException - 如果这种文件对象不支持字符访问
IOException - 如果发生I / O错误
public long getLastModified()
FileObject复制
getLastModified在接口
FileObject
public boolean delete()
FileObject
delete在界面
FileObject
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.