public class SimpleJavaFileObject extends java.lang.Object implements JavaFileObject
JavaFileObject.Kind| Modifier and Type | Field and Description |
|---|---|
protected JavaFileObject.Kind |
kind
The kind of this file object.
|
protected java.net.URI |
uri
A URI for this file object.
|
| Modifier | Constructor and Description |
|---|---|
protected |
SimpleJavaFileObject(java.net.URI uri,
JavaFileObject.Kind kind)
Construct a SimpleJavaFileObject of the given kind and with the
given URI.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
delete()
This implementation does nothing.
|
Modifier |
getAccessLevel()
This implementation returns
null. |
java.lang.CharSequence |
getCharContent(boolean ignoreEncodingErrors)
This implementation always throws UnsupportedOperationException.
|
JavaFileObject.Kind |
getKind()
Gets the kind of this file object.
|
long |
getLastModified()
This implementation returns
0L. |
java.lang.String |
getName()
Gets a user-friendly name for this file object.
|
NestingKind |
getNestingKind()
This implementation returns
null. |
boolean |
isNameCompatible(java.lang.String simpleName,
JavaFileObject.Kind kind)
This implementation compares the path of its URI to the given
simple name.
|
java.io.InputStream |
openInputStream()
This implementation always throws UnsupportedOperationException.
|
java.io.OutputStream |
openOutputStream()
This implementation always throws UnsupportedOperationException.
|
java.io.Reader |
openReader(boolean ignoreEncodingErrors)
Wraps the result of getCharContent(boolean) in a Reader.
|
java.io.Writer |
openWriter()
Wraps the result of openOutputStream in a Writer.
|
java.lang.String |
toString() |
java.net.URI |
toUri()
Returns a URI identifying this file object.
|
protected final java.net.URI uri
protected final JavaFileObject.Kind kind
protected SimpleJavaFileObject(java.net.URI uri,
JavaFileObject.Kind kind)
uri - the URI for this file objectkind - the kind of this file objectpublic java.net.URI toUri()
FileObjecttoUri in interface FileObjectpublic java.lang.String getName()
FileObject"BobsApp\Test.java" on
the command line, this method should return "BobsApp\Test.java" whereas the toUri
method might return file:///C:/Documents%20and%20Settings/UncleBob/BobsApp/Test.java.getName in interface FileObjectpublic java.io.InputStream openInputStream()
throws java.io.IOException
FileObject is
obeyed.openInputStream in interface FileObjectjava.io.IOException - if an I/O error occurredpublic java.io.OutputStream openOutputStream()
throws java.io.IOException
FileObject is
obeyed.openOutputStream in interface FileObjectjava.io.IOException - if an I/O error occurredpublic java.io.Reader openReader(boolean ignoreEncodingErrors)
throws java.io.IOException
FileObject is obeyed.openReader in interface FileObjectignoreEncodingErrors - ignore encoding errors if truejava.lang.IllegalStateException - if this file object was
opened for writing and does not support readingjava.lang.UnsupportedOperationException - if this kind of
file object does not support character accessjava.io.IOException - if an I/O error occurredpublic java.lang.CharSequence getCharContent(boolean ignoreEncodingErrors)
throws java.io.IOException
FileObject is
obeyed.getCharContent in interface FileObjectignoreEncodingErrors - ignore encoding errors if truenull otherwisejava.io.IOException - if an I/O error occurredpublic java.io.Writer openWriter()
throws java.io.IOException
FileObject is obeyed.openWriter in interface FileObjectjava.lang.IllegalStateException - if this file object was
opened for reading and does not support writingjava.lang.UnsupportedOperationException - if this kind of
file object does not support character accessjava.io.IOException - if an I/O error occurredpublic long getLastModified()
0L. Subclasses can change
this behavior as long as the contract of FileObject is
obeyed.getLastModified in interface FileObject0Lpublic boolean delete()
FileObject is
obeyed.delete in interface FileObjectfalsepublic JavaFileObject.Kind getKind()
JavaFileObjectgetKind in interface JavaFileObjectthis.kindpublic boolean isNameCompatible(java.lang.String simpleName,
JavaFileObject.Kind kind)
simpleName + kind.extension or if it ends with "/" + simpleName + kind.extension.
This method calls getKind() and toUri() and
does not access the fields uri and kind
directly.
Subclasses can change this behavior as long as the contract
of JavaFileObject is obeyed.
isNameCompatible in interface JavaFileObjectsimpleName - a simple name of a classkind - a kindtrue if this file object is compatible; false
otherwisepublic NestingKind getNestingKind()
null. Subclasses can
change this behavior as long as the contract of
JavaFileObject is obeyed.getNestingKind in interface JavaFileObjectnull if the nesting kind
is not knownpublic Modifier getAccessLevel()
null. Subclasses can
change this behavior as long as the contract of
JavaFileObject is obeyed.getAccessLevel in interface JavaFileObjectpublic java.lang.String toString()
toString in class java.lang.Object