public class PGCopyInputStream extends java.io.InputStream implements CopyOut
Constructor and Description |
---|
PGCopyInputStream(CopyOut op)
Use given CopyOut operation for reading
|
PGCopyInputStream(PGConnection connection,
java.lang.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 succesful 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() |
public PGCopyInputStream(PGConnection connection, java.lang.String sql) throws java.sql.SQLException
connection
- database connection to use for copying (protocol version 3 required)sql
- COPY TO STDOUT statementjava.sql.SQLException
- if initializing the operation failspublic PGCopyInputStream(CopyOut op)
op
- COPY TO STDOUT operationjava.sql.SQLException
- if initializing the operation failspublic int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] buf) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] buf, int off, int siz) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public byte[] readFromCopy() throws java.sql.SQLException
readFromCopy
in interface CopyOut
java.sql.SQLException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
public void cancelCopy() throws java.sql.SQLException
CopyOperation
cancelCopy
in interface CopyOperation
java.sql.SQLException
- if cancelling failspublic int getFormat()
getFormat
in interface CopyOperation
public int getFieldFormat(int field)
getFieldFormat
in interface CopyOperation
field
- number of field (0..fieldCount()-1)public int getFieldCount()
getFieldCount
in interface CopyOperation
public boolean isActive()
isActive
in interface CopyOperation
public long getHandledRowCount()
CopyOperation
getHandledRowCount
in interface CopyOperation