Documentation of 'javolution37.javolution.xml.XmlInputStream' Java class
XmlInputStream
javolution37.javolution.xml

Class XmlInputStream<T>

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, Reusable


    public class XmlInputStream<T>
    extends java.io.InputStream
    implements Reusable

    This class represents an object input stream using ObjectReader for object deserialization.

    Instances of this class embed their own data buffer, wrapping using a java.io.BufferedInputStream is therefore unnescessary.

    See Also:
    XmlOutputStream
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void close()
      Closes and resets this stream for reuse.
      int read()
      Reads the next byte of data from the input stream.
      int read(byte[] b, int off, int len)
      Reads up to len bytes of data from the input stream into an array of bytes.
      T readObject()
      Reads an object from the underlying stream using an ObjectReader.
      void reset()
      Resets the internal state of this object to its default values.
      XmlInputStream setInputStream(java.io.InputStream in)
      Sets the underlying input source for this stream.
      • Methods inherited from class java.io.InputStream

        available, mark, markSupported, read, skip
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XmlInputStream

        public XmlInputStream()
        Default constructor.
      • XmlInputStream

        public XmlInputStream(ObjectReader<T> reader)
        Creates a xml input stream using the specified object reader.
        Parameters:
        reader - the object reader.
    • Method Detail

      • setInputStream

        public XmlInputStream setInputStream(java.io.InputStream in)
        Sets the underlying input source for this stream.
        Parameters:
        in - the input source.
        Returns:
        this
        Throws:
        java.lang.IllegalStateException - if this stream is being reused and it has not been closed or reset.
      • readObject

        public T readObject()
                     throws java.io.IOException
        Reads an object from the underlying stream using an ObjectReader.
        Returns:
        the object read from its xml representation.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • close

        public void close()
                   throws java.io.IOException
        Closes and resets this stream for reuse.
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface java.lang.AutoCloseable
        Overrides:
        close in class java.io.InputStream
        Throws:
        java.io.IOException - if an I/O error occurs.
      • read

        public int read()
                 throws java.io.IOException
        Reads the next byte of data from the input stream.
        Specified by:
        read in class java.io.InputStream
        Returns:
        the next byte of data, or -1 if the end of the stream is reached.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • read

        public int read(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Reads up to len bytes of data from the input stream into an array of bytes.
        Overrides:
        read in class java.io.InputStream
        Parameters:
        b - the buffer into which the data is read.
        off - the start offset in array b at which the data is written.
        len - the maximum number of bytes to read.
        Returns:
        the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • reset

        public void reset()
        Description copied from interface: Reusable
        Resets the internal state of this object to its default values.
        Specified by:
        reset in interface Reusable
        Overrides:
        reset in class java.io.InputStream

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.