Package org.smooks.io

Class AbstractOutputStreamResource

    • Constructor Detail

      • AbstractOutputStreamResource

        public AbstractOutputStreamResource()
    • Method Detail

      • getOutputStream

        public abstract OutputStream getOutputStream​(ExecutionContext executionContext)
                                              throws IOException
        Retrieve/create an output stream that is appropriate for the concreate implementation
        Parameters:
        executionContext - Execution Context.
        Returns:
        OutputStream specific to the concreate implementation
        Throws:
        IOException
      • getResourceName

        public String getResourceName()
        Get the name of this resource
        Returns:
        The name of the resource
      • consumes

        public boolean consumes​(Object object)
        Description copied from interface: Consumer
        Does this consumer consume the specified named object.

        The named object would be a product of a Producer that is executing on the same element. The consumer should only return false if it knows for certain that it doesn't consumer the specified named object. If uncertain, it should error on the side of saying that it does consume the object.

        Specified by:
        consumes in interface Consumer
        Parameters:
        object - The product representation
        Returns:
        True if the consumer consumes the specified product, otherwise false.
      • setResourceName

        public AbstractOutputStreamResource setResourceName​(String resourceName)
        Set the name of this resource
        Parameters:
        resourceName - The name of the resource
      • getWriterEncoding

        public Charset getWriterEncoding()
      • onPostFragment

        public void onPostFragment​(Fragment<?> fragment,
                                   ExecutionContext executionContext)
        Description copied from interface: PostFragmentLifecycle
        Cleanup the resources allocated by this resource for the specified ExecutionContext.

        Executes the cleanup at the end of the fragment visit.

        Specified by:
        onPostFragment in interface PostFragmentLifecycle
        Parameters:
        fragment - The fragment.
        executionContext - The ExecutionContext.
      • onPostExecution

        public void onPostExecution​(ExecutionContext executionContext)
        Description copied from interface: PostExecutionLifecycle
        Cleanup the resources allocated by this resource for the specified ExecutionContext.

        Executes the cleanup at the end of the filter execution.

        Specified by:
        onPostExecution in interface PostExecutionLifecycle
        Parameters:
        executionContext - The ExecutionContext.
      • closeCondition

        protected boolean closeCondition​(ExecutionContext executionContext)
      • closeResource

        protected void closeResource​(ExecutionContext executionContext)
        Close the resource output stream.

        Classes overriding this method must call super on this method. This will probably need to be done before performing any aditional cleanup.

        Parameters:
        executionContext - Smooks ExecutionContext