パッケージ org.postgresql.copy

クラス PGCopyInputStream

java.lang.Object
java.io.InputStream
org.postgresql.copy.PGCopyInputStream
すべての実装されたインタフェース:
Closeable, AutoCloseable, CopyOperation, CopyOut

public class PGCopyInputStream extends InputStream implements CopyOut
InputStream for reading from a PostgreSQL COPY TO STDOUT operation.
  • コンストラクタの詳細

    • PGCopyInputStream

      public PGCopyInputStream(PGConnection connection, String sql) throws SQLException
      Uses given connection for specified COPY TO STDOUT operation.
      パラメータ:
      connection - database connection to use for copying (protocol version 3 required)
      sql - COPY TO STDOUT statement
      例外:
      SQLException - if initializing the operation fails
    • PGCopyInputStream

      public PGCopyInputStream(CopyOut op)
      Use given CopyOut operation for reading.
      パラメータ:
      op - COPY TO STDOUT operation
  • メソッドの詳細

    • available

      public int available() throws IOException
      オーバーライド:
      available クラス内 InputStream
      例外:
      IOException
    • read

      public int read() throws IOException
      定義:
      read クラス内 InputStream
      例外:
      IOException
    • read

      public int read(byte[] buf) throws IOException
      オーバーライド:
      read クラス内 InputStream
      例外:
      IOException
    • read

      public int read(byte[] buf, int off, int siz) throws IOException
      オーバーライド:
      read クラス内 InputStream
      例外:
      IOException
    • readFromCopy

      public byte @Nullable [] readFromCopy() throws SQLException
      インタフェースからコピーされた説明: CopyOut
      Blocks wait for a row of data to be received from server on an active copy operation.
      定義:
      readFromCopy インタフェース内 CopyOut
      戻り値:
      byte array received from server, null if server complete copy operation
      例外:
      SQLException - if something goes wrong for example socket timeout
    • readFromCopy

      public byte @Nullable [] readFromCopy(boolean block) throws SQLException
      インタフェースからコピーされた説明: CopyOut
      Wait for a row of data to be received from server on an active copy operation.
      定義:
      readFromCopy インタフェース内 CopyOut
      パラメータ:
      block - true if need wait data from server otherwise false and will read pending message from server
      戻り値:
      byte array received from server, if pending message from server absent and use no blocking mode return null
      例外:
      SQLException - if something goes wrong for example socket timeout
    • close

      public void close() throws IOException
      定義:
      close インタフェース内 AutoCloseable
      定義:
      close インタフェース内 Closeable
      オーバーライド:
      close クラス内 InputStream
      例外:
      IOException
    • cancelCopy

      public void cancelCopy() throws SQLException
      インタフェースからコピーされた説明: CopyOperation
      Cancels this copy operation, discarding any exchanged data.
      定義:
      cancelCopy インタフェース内 CopyOperation
      例外:
      SQLException - if cancelling fails
    • getFormat

      public int getFormat()
      定義:
      getFormat インタフェース内 CopyOperation
      戻り値:
      overall format of each row: 0 = textual, 1 = binary
    • getFieldFormat

      public int getFieldFormat(int field)
      定義:
      getFieldFormat インタフェース内 CopyOperation
      パラメータ:
      field - number of field (0..fieldCount()-1)
      戻り値:
      format of requested field: 0 = textual, 1 = binary
    • getFieldCount

      public int getFieldCount()
      定義:
      getFieldCount インタフェース内 CopyOperation
      戻り値:
      number of fields in each row for this operation
    • isActive

      public boolean isActive()
      定義:
      isActive インタフェース内 CopyOperation
      戻り値:
      is connection reserved for this Copy operation?
    • getHandledRowCount

      public long getHandledRowCount()
      インタフェースからコピーされた説明: CopyOperation
      After successful end of copy, returns the number of database records handled in that operation. Only implemented in PostgreSQL server version 8.2 and up. Otherwise, returns -1.
      定義:
      getHandledRowCount インタフェース内 CopyOperation
      戻り値:
      number of handled rows or -1