Geen cache-versie.

Caching uitgeschakeld. Standaardinstelling voor deze pagina:ingeschakeld (code LNG204)
Als het scherm te langzaam is, kunt u de gebruikersmodus uitschakelen om de cacheversie te bekijken.
javax.tools

Class SimpleJavaFileObject

  • All Implemented Interfaces:
    FileObject, 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.
    Since:
    1.6
    • Field Detail

      • 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

      • toUri

        public URI toUri()
        Description copied from interface: FileObject
        Returns a URI identifying this file object.
        Specified by:
        toUri in interface FileObject
        Returns:
        a URI
      • getName

        public String getName()
        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
        Returns:
        a user-friendly name
      • 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 FileObject is obeyed.
        Specified by:
        openWriter in interface FileObject
        Returns:
        a Writer wrapping the result of openOutputStream
        Throws:
        IllegalStateException - if this file object was opened for reading and does not support writing
        UnsupportedOperationException - if this kind of file object does not support character access
        IOException - if an I/O error occurred
      • getLastModified

        public long getLastModified()
        This implementation returns 0L. Subclasses can change this behavior as long as the contract of FileObject is obeyed.
        Specified by:
        getLastModified in interface FileObject
        Returns:
        0L
      • delete

        public boolean delete()
        This implementation does nothing. Subclasses can change this behavior as long as the contract of FileObject is obeyed.
        Specified by:
        delete in interface FileObject
        Returns:
        false
      • 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 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.

        Specified by:
        isNameCompatible in interface JavaFileObject
        Parameters:
        simpleName - a simple name of a class
        kind - a kind
        Returns:
        true if this file object is compatible; false otherwise
      • getNestingKind

        public NestingKind getNestingKind()
        This implementation returns null. Subclasses can change this behavior as long as the contract of JavaFileObject is obeyed.
        Specified by:
        getNestingKind in interface JavaFileObject
        Returns:
        the nesting kind, or null if the nesting kind is not known
      • getAccessLevel

        public Modifier getAccessLevel()
        This implementation returns null. Subclasses can change this behavior as long as the contract of JavaFileObject is obeyed.
        Specified by:
        getAccessLevel in interface JavaFileObject
        Returns:
        the access level
      • toString

        public String toString()
        Description copied from class: Object
        Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

        The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

         getClass().getName() + '@' + Integer.toHexString(hashCode())
         
        Overrides:
        toString in class Object
        Returns:
        a string representation of the object.

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/tools/SimpleJavaFileObject.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : https://docs.oracle.com

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut