com.sun.tools.javac.file
Class RegularFileObject

java.lang.Object
  extended by com.sun.tools.javac.file.BaseFileObject
      extended by com.sun.tools.javac.file.RegularFileObject
All Implemented Interfaces:
FileObject, JavaFileObject

 class RegularFileObject
extends BaseFileObject

A subclass of JavaFileObject representing regular files.


Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.tools.JavaFileObject
JavaFileObject.Kind
 
Field Summary
(package private)  java.io.File f
           
private  boolean hasParents
          Have the parent directories been created?
private  java.lang.String name
           
 
Fields inherited from class com.sun.tools.javac.file.BaseFileObject
fileManager
 
Constructor Summary
RegularFileObject(JavacFileManager fileManager, java.io.File f)
           
RegularFileObject(JavacFileManager fileManager, java.lang.String name, java.io.File f)
           
 
Method Summary
 boolean delete()
          Deletes this file object.
private  void ensureParentDirectoriesExist()
           
 boolean equals(java.lang.Object other)
           
 java.nio.CharBuffer getCharContent(boolean ignoreEncodingErrors)
          Gets the character content of this file object, if available.
protected  java.nio.charset.CharsetDecoder getDecoder(boolean ignoreEncodingErrors)
           
 long getLastModified()
          Gets the time this file object was last modified.
 java.lang.String getName()
          Deprecated. 
 java.lang.String getPath()
          Deprecated. 
 int hashCode()
           
protected  java.lang.String inferBinaryName(java.lang.Iterable<? extends java.io.File> path)
           
 boolean isNameCompatible(java.lang.String cn, 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.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, getKind, getNestingKind, openReader, removeExtension, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

hasParents

private boolean hasParents
Have the parent directories been created?


name

private java.lang.String name

f

final java.io.File f
Constructor Detail

RegularFileObject

public RegularFileObject(JavacFileManager fileManager,
                         java.io.File f)

RegularFileObject

public RegularFileObject(JavacFileManager fileManager,
                         java.lang.String name,
                         java.io.File f)
Method Detail

openInputStream

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

Returns:
an InputStream
Throws:
java.io.IOException - if an I/O error occurred

getDecoder

protected java.nio.charset.CharsetDecoder getDecoder(boolean ignoreEncodingErrors)
Overrides:
getDecoder in class BaseFileObject

openOutputStream

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

Returns:
an OutputStream
Throws:
java.io.IOException - if an I/O error occurred

openWriter

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

Returns:
a Writer
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

ensureParentDirectoriesExist

private void ensureParentDirectoriesExist()
                                   throws java.io.IOException
Throws:
java.io.IOException

getName

@Deprecated
public java.lang.String getName()
Deprecated. 

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

isNameCompatible

public boolean isNameCompatible(java.lang.String cn,
                                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:
cn - a simple name of a class
kind - a kind
Returns:
true if this file object is compatible; false otherwise

getPath

@Deprecated
public java.lang.String getPath()
Deprecated. 

Overrides:
getPath in class BaseFileObject

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)
                                   throws java.io.IOException
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
Throws:
java.io.IOException - if an I/O error occurred

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

toUri

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

Returns:
a URI