public class PGCopyInputStream extends InputStream implements CopyOut
| Constructor and Description |
|---|
PGCopyInputStream(CopyOut op)
Use given CopyOut operation for reading.
|
PGCopyInputStream(PGConnection connection,
String sql)
Uses given connection for specified COPY TO STDOUT operation.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
cancelCopy()
Cancels this copy operation, discarding any exchanged data.
|
void |
close() |
int |
getFieldCount() |
int |
getFieldFormat(int field) |
int |
getFormat() |
long |
getHandledRowCount()
After successful end of copy, returns the number of database records handled in that operation.
|
boolean |
isActive() |
int |
read() |
int |
read(byte[] buf) |
int |
read(byte[] buf,
int off,
int siz) |
byte[] |
readFromCopy()
Blocks wait for a row of data to be received from server on an active copy operation.
|
byte[] |
readFromCopy(boolean block)
Wait for a row of data to be received from server on an active copy operation.
|
mark, markSupported, reset, skippublic PGCopyInputStream(PGConnection connection, String sql) throws SQLException
connection - database connection to use for copying (protocol version 3 required)sql - COPY TO STDOUT statementSQLException - if initializing the operation failspublic PGCopyInputStream(CopyOut op)
op - COPY TO STDOUT operationpublic int available()
throws IOException
available in class InputStreamIOExceptionpublic int read()
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] buf)
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] buf,
int off,
int siz)
throws IOException
read in class InputStreamIOExceptionpublic byte[] readFromCopy()
throws SQLException
CopyOutreadFromCopy in interface CopyOutSQLException - if something goes wrong for example socket timeoutpublic byte[] readFromCopy(boolean block)
throws SQLException
CopyOutreadFromCopy in interface CopyOutblock - true if need wait data from server otherwise false and will read
pending message from serverSQLException - if something goes wrong for example socket timeoutpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionpublic void cancelCopy()
throws SQLException
CopyOperationcancelCopy in interface CopyOperationSQLException - if cancelling failspublic int getFormat()
getFormat in interface CopyOperationpublic int getFieldFormat(int field)
getFieldFormat in interface CopyOperationfield - number of field (0..fieldCount()-1)public int getFieldCount()
getFieldCount in interface CopyOperationpublic boolean isActive()
isActive in interface CopyOperationpublic long getHandledRowCount()
CopyOperationgetHandledRowCount in interface CopyOperationCopyright © 1997-2020 PostgreSQL Global Development Group. All Rights Reserved.