Class ParserInputStreamDataSource

  • All Implemented Interfaces:
    OMDataSource, OMDataSourceExt

    public class ParserInputStreamDataSource
    extends OMDataSourceExtBase
    A DataSource that is backed by an InputStream (read from a parser). The Data in this Data source owns the payload inputStream.
    • Constructor Detail

      • ParserInputStreamDataSource

        public ParserInputStreamDataSource​(InputStream payload,
                                           String encoding)
        This is the constructor that is normally called. Note that the ParserInputStreamDataSource takes ownership of the payload InputStream. It may copy, mark or reset the stream. Callers should not access the stream after this constructor is called
        Parameters:
        payload - InputStream
        encoding -
      • ParserInputStreamDataSource

        public ParserInputStreamDataSource​(InputStream payload,
                                           String encoding,
                                           int behavior)
        This constructor is used to test the different Behavior settings. Note that the ParserInputStreamDataSource takes ownership of the payload InputStream. It may copy, mark or reset the stream. Callers should not access the stream after this constructor is called.
        Parameters:
        payload -
        encoding -
        behavior -
    • Method Detail

      • numReads

        public int numReads()
      • getObject

        public Object getObject()
        Description copied from interface: OMDataSourceExt
        Returns the backing Object.
        Returns:
        Object
      • isDestructiveRead

        public boolean isDestructiveRead()
        Description copied from interface: OMDataSourceExt
        Returns true if reading the backing object is destructive. An example of an object with a destructive read is an InputSteam. The owning OMSourcedElement uses this information to detemine if OM tree expansion is needed when reading the OMDataSourceExt.
        Returns:
        boolean
      • isDestructiveWrite

        public boolean isDestructiveWrite()
        Description copied from interface: OMDataSourceExt
        Returns true if writing the backing object is destructive. An example of an object with a destructive write is an InputStream. The owning OMSourcedElement uses this information to detemine if OM tree expansion is needed when writing the OMDataSourceExt.
        Returns:
        boolean
      • close

        public void close()
        Description copied from interface: OMDataSourceExt
        Close the DataSource and free its resources.
      • copy

        public OMDataSourceExt copy()
        Return a InputStreamDataSource backed by a ByteArrayInputStream
        Returns:
        OMDataSourceExt