|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
org.postgresql.copy.PGCopyOutputStream
public class PGCopyOutputStream
OutputStream for buffered input into a PostgreSQL COPY FROM STDIN operation
Constructor Summary | |
---|---|
PGCopyOutputStream(CopyIn op)
Use given CopyIn operation for writing |
|
PGCopyOutputStream(CopyIn op,
int bufferSize)
Use given CopyIn operation for writing |
|
PGCopyOutputStream(PGConnection connection,
java.lang.String sql)
Uses given connection for specified COPY FROM STDIN operation |
|
PGCopyOutputStream(PGConnection connection,
java.lang.String sql,
int bufferSize)
Uses given connection for specified COPY FROM STDIN operation |
Method Summary | |
---|---|
void |
cancelCopy()
Cancels this copy operation, discarding any exchanged data. |
void |
close()
|
long |
endCopy()
Finishes copy operation succesfully. |
void |
flush()
|
void |
flushCopy()
Force any buffered output to be sent over the network to the backend. |
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()
|
void |
write(byte[] buf)
|
void |
write(byte[] buf,
int off,
int siz)
|
void |
write(int b)
|
void |
writeToCopy(byte[] buf,
int off,
int siz)
Writes specified part of given byte array to an open and writable copy operation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PGCopyOutputStream(PGConnection connection, java.lang.String sql) throws java.sql.SQLException
connection
- database connection to use for copying (protocol version 3 required)sql
- COPY FROM STDIN statement
java.sql.SQLException
- if initializing the operation failspublic PGCopyOutputStream(PGConnection connection, java.lang.String sql, int bufferSize) throws java.sql.SQLException
connection
- database connection to use for copying (protocol version 3 required)sql
- COPY FROM STDIN statementbufferSize
- try to send this many bytes at a time
java.sql.SQLException
- if initializing the operation failspublic PGCopyOutputStream(CopyIn op)
op
- COPY FROM STDIN operationpublic PGCopyOutputStream(CopyIn op, int bufferSize)
op
- COPY FROM STDIN operationbufferSize
- try to send this many bytes at a timeMethod Detail |
---|
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] buf) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] buf, int off, int siz) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.OutputStream
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
public void writeToCopy(byte[] buf, int off, int siz) throws java.sql.SQLException
CopyIn
writeToCopy
in interface CopyIn
buf
- array of bytes to writeoff
- offset of first byte to write (normally zero)siz
- number of bytes to write (normally buf.length)
java.sql.SQLException
- if the operation failspublic int getFormat()
getFormat
in interface CopyOperation
public int getFieldFormat(int field)
getFieldFormat
in interface CopyOperation
field
- number of field (0..fieldCount()-1)
public void cancelCopy() throws java.sql.SQLException
CopyOperation
cancelCopy
in interface CopyOperation
java.sql.SQLException
- if cancelling failspublic int getFieldCount()
getFieldCount
in interface CopyOperation
public boolean isActive()
isActive
in interface CopyOperation
public void flushCopy() throws java.sql.SQLException
CopyIn
flushCopy
in interface CopyIn
java.sql.SQLException
public long endCopy() throws java.sql.SQLException
CopyIn
endCopy
in interface CopyIn
java.sql.SQLException
- if the operation fails.public long getHandledRowCount()
CopyOperation
getHandledRowCount
in interface CopyOperation
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |