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.
java.beans

Class XMLDecoder

  • All Implemented Interfaces:
    AutoCloseable

    public class XMLDecoder
    extends Object
    implements AutoCloseable
    The XMLDecoder class is used to read XML documents created using the XMLEncoder and is used just like the ObjectInputStream. For example, one can use the following fragment to read the first object defined in an XML document written by the XMLEncoder class:
           XMLDecoder d = new XMLDecoder(
                              new BufferedInputStream(
                                  new FileInputStream("Test.xml")));
           Object result = d.readObject();
           d.close();
     

    For more information you might also want to check out Long Term Persistence of JavaBeans Components: XML Schema, an article in The Swing Connection.

    Since:
    1.4
    See Also:
    XMLEncoder, ObjectInputStream
    • Constructor Detail

      • XMLDecoder

        public XMLDecoder(InputStream in,
                  Object owner)
        Creates a new input stream for reading archives created by the XMLEncoder class.
        Parameters:
        in - The underlying stream.
        owner - The owner of this stream.
      • XMLDecoder

        public XMLDecoder(InputStream in,
                  Object owner,
                  ExceptionListener exceptionListener)
        Creates a new input stream for reading archives created by the XMLEncoder class.
        Parameters:
        in - the underlying stream.
        owner - the owner of this stream.
        exceptionListener - the exception handler for the stream; if null the default exception listener will be used.
      • XMLDecoder

        public XMLDecoder(InputStream in,
                  Object owner,
                  ExceptionListener exceptionListener,
                  ClassLoader cl)
        Creates a new input stream for reading archives created by the XMLEncoder class.
        Parameters:
        in - the underlying stream. null may be passed without error, though the resulting XMLDecoder will be useless
        owner - the owner of this stream. null is a legal value
        exceptionListener - the exception handler for the stream, or null to use the default
        cl - the class loader used for instantiating objects. null indicates that the default class loader should be used
        Since:
        1.5
      • XMLDecoder

        public XMLDecoder(InputSource is)
        Creates a new decoder to parse XML archives created by the XMLEncoder class. If the input source is is null, no exception is thrown and no parsing is performed. This behavior is similar to behavior of other constructors that use InputStream as a parameter.
        Parameters:
        is - the input source to parse
        Since:
        1.7
    • Method Detail

      • close

        public void close()
        This method closes the input stream associated with this stream.
        Specified by:
        close in interface AutoCloseable
      • setExceptionListener

        public void setExceptionListener(ExceptionListener exceptionListener)
        Sets the exception handler for this stream to exceptionListener. The exception handler is notified when this stream catches recoverable exceptions.
        Parameters:
        exceptionListener - The exception handler for this stream; if null the default exception listener will be used.
        See Also:
        getExceptionListener()
      • setOwner

        public void setOwner(Object owner)
        Sets the owner of this decoder to owner.
        Parameters:
        owner - The owner of this decoder.
        See Also:
        getOwner()
      • createHandler

        public static DefaultHandler createHandler(Object owner,
                                   ExceptionListener el,
                                   ClassLoader cl)
        Creates a new handler for SAX parser that can be used to parse embedded XML archives created by the XMLEncoder class. The owner should be used if parsed XML document contains the method call within context of the <java> element. The null value may cause illegal parsing in such case. The same problem may occur, if the owner class does not contain expected method to call. See details here.
        Parameters:
        owner - the owner of the default handler that can be used as a value of <java> element
        el - the exception handler for the parser, or null to use the default exception handler
        cl - the class loader used for instantiating objects, or null to use the default class loader
        Returns:
        an instance of DefaultHandler for SAX parser
        Since:
        1.7

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-java/beans/xmldecoder.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