Top Description Methods
org.postgresql.copy

public Interface CopyIn

extends CopyOperation
Known Direct Subinterfaces
org.postgresql.copy.CopyDual
Known Direct Implementers
org.postgresql.copy.PGCopyOutputStream, org.postgresql.core.v3.CopyInImpl
Imports
org.postgresql.util.ByteStreamWriter, java.sql.SQLException

Copy bulk data from client into a PostgreSQL table very fast.

Method Summary

Modifier and TypeMethod and Description
public long

Returns:

number of updated rows for server 8.2 or newer (see getHandledRowCount())
endCopy
()

Finishes copy operation successfully.

public void
flushCopy()

Force any buffered output to be sent over the network to the backend.

public void
writeToCopy(byte[]
array of bytes to write
buf
,
int
offset of first byte to write (normally zero)
off
,
int
number of bytes to write (normally buf.length)
siz
)

Writes specified part of given byte array to an open and writable copy operation.

public void
writeToCopy(ByteStreamWriter
the source of bytes, e.g. a ByteBufferByteStreamWriter
from
)

Writes a ByteStreamWriter to an open and writable copy operation.

Inherited from org.postgresql.copy.CopyOperation:
cancelCopygetFieldCountgetFieldFormatgetFormatgetHandledRowCountisActive

Method Detail

endCopyback to summary
public long endCopy() throws SQLException

Finishes copy operation successfully.

Returns:long

number of updated rows for server 8.2 or newer (see getHandledRowCount())

Exceptions
SQLException:
if the operation fails.
flushCopyback to summary
public void flushCopy() throws SQLException

Force any buffered output to be sent over the network to the backend. In general this is a useless operation as it will get pushed over in due time or when endCopy is called. Some specific modified server versions (Truviso) want this data sooner. If you are unsure if you need to use this method, don't.

Exceptions
SQLException:
if the operation fails.
writeToCopyback to summary
public void writeToCopy(byte[] buf, int off, int siz) throws SQLException

Writes specified part of given byte array to an open and writable copy operation.

Parameters
buf:byte[]

array of bytes to write

off:int

offset of first byte to write (normally zero)

siz:int

number of bytes to write (normally buf.length)

Exceptions
SQLException:
if the operation fails
writeToCopyback to summary
public void writeToCopy(ByteStreamWriter from) throws SQLException

Writes a ByteStreamWriter to an open and writable copy operation.

Parameters
from:ByteStreamWriter

the source of bytes, e.g. a ByteBufferByteStreamWriter

Exceptions
SQLException:
if the operation fails