Class V2Session

All Implemented Interfaces:
Closeable, AutoCloseable, CTISession

public class V2Session extends AbstractCTISession implements CTISession
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    protected jp.cssj.rsr.RandomBuilder
     
    protected final String
     
    protected MessageHandler
     
    protected final String
     
     
     
     
    protected jp.cssj.resolver.SourceResolver
     
    protected Results
     
    protected int
     
    protected final URI
     
    protected final String
     

    Fields inherited from interface jp.cssj.cti2.CTISession

    ABORT_FORCE, ABORT_NORMAL
  • Constructor Summary

    Constructors
    Constructor
    Description
    V2Session(URI uri, String encoding, String user, String password)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    abort(byte mode)
    変換を中断します。 このメソッドは非同期的に(別スレッドから)呼び出す必要があります。 実際に処理が中断された場合は、変換処理を行なっている(transcodeを呼び出した )スレッドで、TranscoderExceptionがスローされます。
    protected boolean
     
    void
    セッションをクローズします。
    サーバー情報を返します。 詳細はCopper PDF ドキュメントを参照して下さい。
    protected void
     
    void
    setContinues(true) が設定された状態で、複数回のtranscodeにより生成された結果を結合して出力します。
    protected void
     
    void
    property(String key, String value)
    プロパティを設定します。
    void
    送られたリソースと、プロパティ、メッセージハンドラ等の全ての設定をクリアして、セッションが作られた時点と同じ初期状態に戻します。
    resource(jp.cssj.resolver.MetaSource metaSource)
    リソースを送信するための出力ストリームを返します。
    void
    resource(jp.cssj.resolver.Source source)
    リソースを送信します。
    void
    sendResource(jp.cssj.resolver.Source source)
     
    void
    setContinuous(boolean continuous)
    複数の結果を結合するモードに切り替えます。
    void
    メッセージを受け取るためのオブジェクトを設定します。
    void
    進行状況を監視するためのオブジェクトを設定します。
    void
    出力先を設定します。
    void
    setSourceResolver(jp.cssj.resolver.SourceResolver resolver)
    リソースを読み込むためのオブジェクトを設定します。
    void
    指定されたアドレスへサーバー側からアクセスしてメインドキュメントを取得して変換します。 resourceメソッドで事前に送信したリソースに対しても有効です。
    transcode(jp.cssj.resolver.MetaSource metaSource)
    メインドキュメントを送信するための出力ストリームを返します。
    void
    transcode(jp.cssj.resolver.Source source)
    メインドキュメントをデータソースから取得して変換します。

    Methods inherited from class jp.cssj.cti2.helpers.AbstractCTISession

    finalize

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 V2ContentProducer producer
    • request

      protected V2RequestConsumer request
    • results

      protected Results results
    • resolver

      protected jp.cssj.resolver.SourceResolver resolver
    • messageHandler

      protected MessageHandler messageHandler
    • progressListener

      protected ProgressListener progressListener
    • state

      protected int state
    • builder

      protected jp.cssj.rsr.RandomBuilder 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
      サーバー情報を返します。 詳細はCopper PDF ドキュメントを参照して下さい。
      Specified by:
      getServerInfo in interface CTISession
      Parameters:
      uri - サーバー情報を選択するためのURI。
      Returns:
      サーバー情報データのストリーム。
      Throws:
      IOException
    • setResults

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

      出力先を設定します。

      このメソッドは各transcodeメソッドの前に呼ぶ必要があります。

      Specified by:
      setResults in interface CTISession
      Parameters:
      results - 出力先。
      Throws:
      IOException
    • setMessageHandler

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

      メッセージを受け取るためのオブジェクトを設定します。

      このメソッドは各transcodeメソッドの前に呼ぶ必要があります。

      Specified by:
      setMessageHandler in interface CTISession
      Parameters:
      eh - メッセージハンドラ
      See Also:
    • setProgressListener

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

      進行状況を監視するためのオブジェクトを設定します。

      このメソッドは各transcodeメソッドの前に呼ぶ必要があります。

      Specified by:
      setProgressListener in interface CTISession
      Parameters:
      l - 進行状況リスナ
      See Also:
    • property

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

      プロパティを設定します。

      このメソッドは各transcodeメソッドの前に呼ぶ必要があります。

      Specified by:
      property in interface CTISession
      Parameters:
      key - プロパティ名
      value - 値
      Throws:
      IOException
    • resource

      public OutputStream resource(jp.cssj.resolver.MetaSource metaSource) throws IOException
      Description copied from interface: CTISession

      リソースを送信するための出力ストリームを返します。

      リソースを送信した後、出力ストリームは必ずクローズしてください。

      このメソッドは各transcodeメソッドの前に呼ぶ必要があります。

      Specified by:
      resource in interface CTISession
      Parameters:
      metaSource - リソースデータのメタ情報。
      Returns:
      サーバーへの出力ストリーム。
      Throws:
      IOException
    • resource

      public void resource(jp.cssj.resolver.Source source) throws IOException
      Description copied from interface: CTISession

      リソースを送信します。

      このメソッドは各transcodeメソッドの前に呼ぶ必要があります。

      Specified by:
      resource in interface CTISession
      Parameters:
      source - リソースのデータソース。
      Throws:
      IOException
    • buildNext

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

      public OutputStream transcode(jp.cssj.resolver.MetaSource metaSource) throws IOException, TranscoderException
      Description copied from interface: CTISession

      メインドキュメントを送信するための出力ストリームを返します。

      本体を送信した後、出力ストリームは必ずクローズしてください。

      Specified by:
      transcode in interface CTISession
      Parameters:
      metaSource - メインドキュメントのメタ情報。
      Returns:
      サーバーへの出力ストリーム。
      Throws:
      IOException
      TranscoderException
    • transcode

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

      指定されたアドレスへサーバー側からアクセスしてメインドキュメントを取得して変換します。 resourceメソッドで事前に送信したリソースに対しても有効です。

      Specified by:
      transcode in interface CTISession
      Parameters:
      uri - メインドキュメントのURI。
      Throws:
      IOException
      TranscoderException
    • transcode

      public void transcode(jp.cssj.resolver.Source source) throws IOException, TranscoderException
      Description copied from interface: CTISession

      メインドキュメントをデータソースから取得して変換します。

      Specified by:
      transcode in interface CTISession
      Parameters:
      source - メインドキュメントのデータソース。
      Throws:
      IOException
      TranscoderException
    • next

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

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

      複数の結果を結合するモードに切り替えます。

      Specified by:
      setContinuous in interface CTISession
      Parameters:
      continuous - trueであればjoinにより結果を結合するモードにします。
      Throws:
      IOException
    • join

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

      setContinues(true) が設定された状態で、複数回のtranscodeにより生成された結果を結合して出力します。

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

      public void setSourceResolver(jp.cssj.resolver.SourceResolver resolver) throws IOException
      Description copied from interface: CTISession

      リソースを読み込むためのオブジェクトを設定します。

      Specified by:
      setSourceResolver in interface CTISession
      Parameters:
      resolver - サーバー側から要求したリソースを取得するためのSourceResolver。
      Throws:
      IOException
    • sendResource

      public void sendResource(jp.cssj.resolver.Source source) throws IOException
      Throws:
      IOException
    • abort

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

      変換を中断します。 このメソッドは非同期的に(別スレッドから)呼び出す必要があります。 実際に処理が中断された場合は、変換処理を行なっている(transcodeを呼び出した )スレッドで、TranscoderExceptionがスローされます。

      Specified by:
      abort in interface CTISession
      Parameters:
      mode - きりのよいところまで出力する場合はABORT_NORMAL、強制的に処理を停止するにはABORT_FORCEを指定します。
      Throws:
      IOException
    • reset

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

      送られたリソースと、プロパティ、メッセージハンドラ等の全ての設定をクリアして、セッションが作られた時点と同じ初期状態に戻します。

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

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

      セッションをクローズします。

      このメソッドを呼び出した後は、セッションに対して何も出来ません。

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