Class V2Session

All Implemented Interfaces:
Closeable, AutoCloseable, CTISession

public class V2Session extends AbstractCTISession implements CTISession
  • Field Details

    • BUFFER_SIZE

      public static final int BUFFER_SIZE
      See Also:
    • encoding

      protected final String encoding
    • uri

      protected final URI uri
    • user

      protected final String user
    • password

      protected final String password
    • producer

      protected volatile V2ContentProducer producer
    • request

      protected volatile V2RequestConsumer request
    • results

      protected Results results
    • resolver

      protected net.zamasoft.zstream.resolver.SourceResolver resolver
    • messageHandler

      protected MessageHandler messageHandler
    • progressListener

      protected ProgressListener progressListener
    • state

      protected volatile int state
    • builder

      protected net.zamasoft.zstream.io.FragmentedOutput builder
  • Constructor Details

  • Method Details

    • init

      protected void init() throws IOException
      Throws:
      IOException
    • getServerInfo

      public InputStream getServerInfo(URI uri) throws IOException
      Description copied from interface: CTISession
      Returns server information. For details, see the Copper PDF documentation.
      Specified by:
      getServerInfo in interface CTISession
      Parameters:
      uri - The URI that selects the server information.
      Returns:
      A stream of server information data.
      Throws:
      IOException
    • setResults

      public void setResults(Results results) throws IOException
      Description copied from interface: CTISession

      Sets the output destination.

      You must call this method before any transcode method.

      Specified by:
      setResults in interface CTISession
      Parameters:
      results - The output destination.
      Throws:
      IOException
    • setMessageHandler

      public void setMessageHandler(MessageHandler eh)
      Description copied from interface: CTISession

      Sets the object that receives messages.

      You must call this method before any transcode method.

      Specified by:
      setMessageHandler in interface CTISession
      Parameters:
      eh - The message handler
      See Also:
    • setProgressListener

      public void setProgressListener(ProgressListener l)
      Description copied from interface: CTISession

      Sets the object that monitors progress.

      You must call this method before any transcode method.

      Specified by:
      setProgressListener in interface CTISession
      Parameters:
      l - The progress listener
      See Also:
    • property

      public void property(String key, String value) throws IOException
      Description copied from interface: CTISession

      Sets a property.

      You must call this method before any transcode method.

      Specified by:
      property in interface CTISession
      Parameters:
      key - The property name
      value - The value
      Throws:
      IOException
    • resource

      public OutputStream resource(net.zamasoft.zstream.resolver.SourceMetadata metaSource) throws IOException
      Description copied from interface: CTISession

      Returns an output stream for sending a resource.

      Always close the output stream after sending the resource.

      You must call this method before any transcode method.

      Specified by:
      resource in interface CTISession
      Returns:
      An output stream to the server.
      Throws:
      IOException
    • resource

      public void resource(net.zamasoft.zstream.resolver.Source source) throws IOException
      Description copied from interface: CTISession

      Sends a resource.

      You must call this method before any transcode method.

      Specified by:
      resource in interface CTISession
      Parameters:
      source - The data source for the resource.
      Throws:
      IOException
    • buildNext

      protected boolean buildNext() throws IOException, TranscoderException
      Throws:
      IOException
      TranscoderException
    • transcode

      public OutputStream transcode(net.zamasoft.zstream.resolver.SourceMetadata metaSource) throws IOException, TranscoderException
      Description copied from interface: CTISession

      Returns an output stream for sending the main document.

      Always close the output stream after sending the document body.

      Specified by:
      transcode in interface CTISession
      Returns:
      An output stream to the server.
      Throws:
      IOException
      TranscoderException
    • transcode

      public void transcode(URI uri) throws IOException, TranscoderException
      Description copied from interface: CTISession

      Retrieves and converts the main document by accessing the specified address from the server. This also works with resources you previously sent using the resource method.

      Specified by:
      transcode in interface CTISession
      Parameters:
      uri - The URI of the main document.
      Throws:
      IOException
      TranscoderException
    • transcode

      public void transcode(net.zamasoft.zstream.resolver.Source source) throws IOException, TranscoderException
      Description copied from interface: CTISession

      Retrieves the main document from a data source and converts it.

      Specified by:
      transcode in interface CTISession
      Parameters:
      source - The data source for the main document.
      Throws:
      IOException
      TranscoderException
    • next

      protected void next() throws IOException
      Throws:
      IOException
    • setContinuous

      public void setContinuous(boolean continuous) throws IOException
      Description copied from interface: CTISession

      Switches to a mode that combines multiple results.

      Specified by:
      setContinuous in interface CTISession
      Parameters:
      continuous - If true, enables the mode that combines results using join.
      Throws:
      IOException
    • join

      public void join() throws IOException
      Description copied from interface: CTISession

      With setContinues(true) set, combines and outputs the results of multiple transcode calls.

      Specified by:
      join in interface CTISession
      Throws:
      IOException
    • setSourceResolver

      public void setSourceResolver(net.zamasoft.zstream.resolver.SourceResolver resolver) throws IOException
      Description copied from interface: CTISession

      Sets the object that loads resources.

      Specified by:
      setSourceResolver in interface CTISession
      Parameters:
      resolver - The SourceResolver that retrieves resources requested by the server.
      Throws:
      IOException
    • sendResource

      public void sendResource(net.zamasoft.zstream.resolver.Source source) throws IOException
      Throws:
      IOException
    • abort

      public void abort(byte mode) throws IOException
      Description copied from interface: CTISession

      Aborts conversion. You must call this method asynchronously (from another thread). When processing actually stops, the thread performing the conversion (the one that called transcode) throws a TranscoderException.

      Specified by:
      abort in interface CTISession
      Parameters:
      mode - Specify ABORT_NORMAL to output up to a suitable stopping point, or ABORT_FORCE to forcibly stop processing.
      Throws:
      IOException
    • reset

      public void reset() throws IOException
      Description copied from interface: CTISession

      Clears all sent resources and all settings, including properties and the message handler, and restores the initial state the session had when it was created.

      Specified by:
      reset in interface CTISession
      Throws:
      IOException
    • close

      public void close() throws IOException
      Description copied from interface: CTISession

      Closes the session.

      You cannot perform any operations on the session after calling this method.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface CTISession
      Throws:
      IOException