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()
获取此文件的输出流对象。
|
Reader |
openReader(boolean ignoreEncodingErrors)
获取此对象的读者。
|
Writer |
openWriter()
获取此文件对象的一个写作者。
|
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
忽略编码错误如果真的
IllegalStateException
-如果该文件对象打开了写作和不支持读取
UnsupportedOperationException
-如果这类文件对象不支持字符访问
IOException
如果发生I/O错误
public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException
FileObject
ignoreEncodingErrors
报道除非是真的。
getCharContent
接口
FileObject
ignoreEncodingErrors
忽略编码错误如果真的
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.