This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.tools
class SimpleJavaFileObject

java.lang.Object extended by javax.tools.SimpleJavaFileObject
All Implemented Interfaces:
JavaFileObject

public class SimpleJavaFileObject
extends Object
implements JavaFileObject

Provides simple implementations for most methods in JavaFileObject. This class is designed to be subclassed and used as a basis for JavaFileObject implementations. Subclasses can override the implementation and specification of any method of this class as long as the general contract of JavaFileObject is obeyed.


Field Summary
protected JavaFileObject.Kind kind
          The kind of this file object.
protected URI uri
          A URI for this file object.
 
Constructor Summary
protected

          Construct a SimpleJavaFileObject of the given kind and with the given URI.
 
Method Summary
 boolean

          This implementation does nothing.
 Modifier

          This implementation returns .
 CharSequence
getCharContent(boolean ignoreEncodingErrors)

          This implementation always throws java.lang.UnsupportedOperationException.
 JavaFileObject.Kind

          
 long

          This implementation returns .
 String

          
 NestingKind

          This implementation returns .
 boolean

          This implementation compares the path of its URI to the given simple name.
 InputStream

          This implementation always throws java.lang.UnsupportedOperationException.
 OutputStream

          This implementation always throws java.lang.UnsupportedOperationException.
 Reader
openReader(boolean ignoreEncodingErrors)

          Wraps the result of javax.tools.SimpleJavaFileObject.getCharContent in a Reader.
 Writer

          Wraps the result of openOutputStream in a Writer.
 String

          Returns a string representation of the object.
 URI

          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kind

protected final JavaFileObject.Kind kind
The kind of this file object.

uri

protected final URI uri
A URI for this file object.
Constructor Detail

SimpleJavaFileObject

protected SimpleJavaFileObject(URI uri,
                               JavaFileObject.Kind kind)
Construct a SimpleJavaFileObject of the given kind and with the given URI.

Parameters:
uri - the URI for this file object
kind - the kind of this file object
Method Detail

delete

public boolean delete()
This implementation does nothing. Subclasses can change this behavior as long as the contract of {@link FileObject} is obeyed.

Returns:
{@code false}

getAccessLevel

public Modifier getAccessLevel()
This implementation returns {@code null}. Subclasses can change this behavior as long as the contract of {@link JavaFileObject} is obeyed.


getCharContent

public CharSequence getCharContent(boolean ignoreEncodingErrors)
                            throws IOException
This implementation always throws {@linkplain UnsupportedOperationException}. Subclasses can change this behavior as long as the contract of {@link FileObject} is obeyed.

Parameters:
ignoreEncodingErrors
Throws:
IOException

getKind

public JavaFileObject.Kind getKind()
Returns:
{@code this.kind}

getLastModified

public long getLastModified()
This implementation returns {@code 0L}. Subclasses can change this behavior as long as the contract of {@link FileObject} is obeyed.

Returns:
{@code 0L}

getName

public String getName()

getNestingKind

public NestingKind getNestingKind()
This implementation returns {@code null}. Subclasses can change this behavior as long as the contract of {@link JavaFileObject} is obeyed.


isNameCompatible

public boolean isNameCompatible(String simpleName,
                                JavaFileObject.Kind kind)
This implementation compares the path of its URI to the given simple name. This method returns true if the given kind is equal to the kind of this object, and if the path is equal to {@code simpleName + kind.extension} or if it ends with {@code "/" + simpleName + kind.extension}.

This method calls {@link #getKind} and {@link #toUri} and does not access the fields {@link #uri} and {@link #kind} directly.

Subclasses can change this behavior as long as the contract of {@link JavaFileObject} is obeyed.

Parameters:
simpleName
kind

openInputStream

public InputStream openInputStream()
                            throws IOException
This implementation always throws {@linkplain UnsupportedOperationException}. Subclasses can change this behavior as long as the contract of {@link FileObject} is obeyed.

Throws:
IOException

openOutputStream

public OutputStream openOutputStream()
                              throws IOException
This implementation always throws {@linkplain UnsupportedOperationException}. Subclasses can change this behavior as long as the contract of {@link FileObject} is obeyed.

Throws:
IOException

openReader

public Reader openReader(boolean ignoreEncodingErrors)
                  throws IOException
Wraps the result of {@linkplain #getCharContent} in a Reader. Subclasses can change this behavior as long as the contract of {@link FileObject} is obeyed.

Parameters:
ignoreEncodingErrors - {@inheritDoc}
Returns:
a Reader wrapping the result of getCharContent
Throws:
IOException - {@inheritDoc}

openWriter

public Writer openWriter()
                  throws IOException
Wraps the result of openOutputStream in a Writer. Subclasses can change this behavior as long as the contract of {@link FileObject} is obeyed.

Returns:
a Writer wrapping the result of openOutputStream
Throws:
IOException - {@inheritDoc}

toString

public String toString()
Overrides:
toString in class Object

toUri

public URI toUri()


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.