Class BufferedContent

    • Constructor Detail

      • BufferedContent

        protected BufferedContent()
        Creates a buffered stream content accessor.
    • Method Detail

      • getContents

        public InputStream getContents()
                                throws CoreException
        Description copied from interface: IStreamContentAccessor
        Returns an open InputStream for this object which can be used to retrieve the object's content. The client is responsible for closing the stream when finished. Returns null if this object has no streamable contents.
        Specified by:
        getContents in interface IStreamContentAccessor
        an input stream containing the contents of this object
        CoreException - if the contents of this object could not be accessed
      • createStream

        protected abstract InputStream createStream()
                                             throws CoreException
        Creates and returns a stream for reading the contents.

        Subclasses must implement this method.

        the stream from which the content is read
        CoreException - if the contents could not be accessed
      • setContent

        public void setContent​(byte[] contents)
        Sets the contents. Registered content change listeners are notified.
        contents - the new contents
      • getContent

        public byte[] getContent()
        Returns the contents as an array of bytes.
        the contents as an array of bytes, or null if the contents could not be accessed
      • discardBuffer

        public void discardBuffer()
        Discards the buffered content.
      • fireContentChanged

        protected void fireContentChanged()
        Notifies all registered IContentChangeListeners of a content change.