com.sun.tools.javac.jvm
Class ClassReader.SourceFileObject

java.lang.Object
  extended by com.sun.tools.javac.file.BaseFileObject
      extended by com.sun.tools.javac.jvm.ClassReader.SourceFileObject
All Implemented Interfaces:
FileObject, JavaFileObject
Enclosing class:
ClassReader

private static class ClassReader.SourceFileObject
extends BaseFileObject

A subclass of JavaFileObject for the sourcefile attribute found in a classfile. The attribute is only the last component of the original filename, so is unlikely to be valid as is, so operations other than those to access the name throw UnsupportedOperationException


Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.tools.JavaFileObject
JavaFileObject.Kind
 
Field Summary
private  Name flatname
           
private  Name name
          The file's name.
 
Fields inherited from class com.sun.tools.javac.file.BaseFileObject
fileManager
 
Constructor Summary
ClassReader.SourceFileObject(Name name, Name flatname)
           
 
Method Summary
 boolean delete()
          Deletes this file object.
 boolean equals(java.lang.Object other)
           
 java.nio.CharBuffer getCharContent(boolean ignoreEncodingErrors)
          Gets the character content of this file object, if available.
 long getLastModified()
          Gets the time this file object was last modified.
 java.lang.String getName()
          Deprecated. see bug 6410637
 int hashCode()
           
protected  java.lang.String inferBinaryName(java.lang.Iterable<? extends java.io.File> path)
           
 boolean isNameCompatible(java.lang.String simpleName, JavaFileObject.Kind kind)
          Checks if this file object is compatible with the specified simple name and kind.
 java.io.InputStream openInputStream()
          Gets an InputStream for this file object.
 java.io.OutputStream openOutputStream()
          Gets an OutputStream for this file object.
 java.io.Reader openReader()
           
 java.io.Reader openReader(boolean ignoreEncodingErrors)
          Gets a reader for this object.
 java.io.Writer openWriter()
          Gets a Writer for this file object.
 java.net.URI toUri()
          Returns a URI identifying this file object.
 
Methods inherited from class com.sun.tools.javac.file.BaseFileObject
getAccessLevel, getDecoder, getKind, getNestingKind, getPath, removeExtension, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private Name name
The file's name.


flatname

private Name flatname
Constructor Detail

ClassReader.SourceFileObject

public ClassReader.SourceFileObject(Name name,
                                    Name flatname)
Method Detail

openInputStream

public java.io.InputStream openInputStream()
Description copied from interface: FileObject
Gets an InputStream for this file object.

Returns:
an InputStream

openOutputStream

public java.io.OutputStream openOutputStream()
Description copied from interface: FileObject
Gets an OutputStream for this file object.

Returns:
an OutputStream

openReader

public java.io.Reader openReader()

openWriter

public java.io.Writer openWriter()
Description copied from interface: FileObject
Gets a Writer for this file object.

Returns:
a Writer

getName

@Deprecated
public java.lang.String getName()
Deprecated. see bug 6410637

Description copied from interface: FileObject
Gets a user-friendly name for this file object. The exact value returned is not specified but implementations should take care to preserve names as given by the user. For example, if the user writes the filename "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.

Specified by:
getName in interface FileObject
Specified by:
getName in class BaseFileObject
Returns:
a user-friendly name

getLastModified

public long getLastModified()
Description copied from interface: FileObject
Gets the time this file object was last modified. The time is measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970).

Returns:
the time this file object was last modified; or 0 if the file object does not exist, if an I/O error occurred, or if the operation is not supported

delete

public boolean delete()
Description copied from interface: FileObject
Deletes this file object. In case of errors, returns false.

Returns:
true if and only if this file object is successfully deleted; false otherwise

getCharContent

public java.nio.CharBuffer getCharContent(boolean ignoreEncodingErrors)
Description copied from interface: FileObject
Gets the character content of this file object, if available. Any byte that cannot be decoded will be replaced by the default translation character. In addition, a diagnostic may be reported unless ignoreEncodingErrors is true.

Parameters:
ignoreEncodingErrors - ignore encoding errors if true
Returns:
a CharSequence if available; null otherwise

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

isNameCompatible

public boolean isNameCompatible(java.lang.String simpleName,
                                JavaFileObject.Kind kind)
Description copied from interface: JavaFileObject
Checks if this file object is compatible with the specified simple name and kind. A simple name is a single identifier (not qualified) as defined in the Java Language Specification 3rd ed., section 6.2 "Names and Identifiers".

Parameters:
simpleName - a simple name of a class
kind - a kind
Returns:
true if this file object is compatible; false otherwise

toUri

public java.net.URI toUri()
Description copied from interface: FileObject
Returns a URI identifying this file object.

Returns:
a URI

openReader

public java.io.Reader openReader(boolean ignoreEncodingErrors)
                          throws java.io.IOException
Description copied from interface: FileObject
Gets a reader for this object. The returned reader will replace bytes that cannot be decoded with the default translation character. In addition, the reader may report a diagnostic unless ignoreEncodingErrors is true.

Specified by:
openReader in interface FileObject
Overrides:
openReader in class BaseFileObject
Parameters:
ignoreEncodingErrors - ignore encoding errors if true
Returns:
a Reader
Throws:
java.io.IOException - if an I/O error occurred

inferBinaryName

protected java.lang.String inferBinaryName(java.lang.Iterable<? extends java.io.File> path)
Specified by:
inferBinaryName in class BaseFileObject