public void setEncoding(Encoding encoding) throws IOException { pgStream.setEncoding(encoding); }
void setEncoding(Encoding encoding) throws IOException { pgStream.setEncoding(encoding); }
/** * Switch this stream to using a new socket. Any existing socket * is <em>not</em> closed; it's assumed that we are changing to * a new socket that delegates to the original socket (e.g. SSL). * * @param socket the new socket to change to * @throws IOException if something goes wrong */ public void changeSocket(Socket socket) throws IOException { this.connection = socket; // Submitted by Jason Venner <jason@idiom.com>. Disable Nagle // as we are selective about flushing output only when we // really need to. connection.setTcpNoDelay(true); // Buffer sizes submitted by Sverre H Huseby <sverrehu@online.no> pg_input = new VisibleBufferedInputStream(connection.getInputStream(), 8192); pg_output = new BufferedOutputStream(connection.getOutputStream(), 8192); if (encoding != null) setEncoding(encoding); }
/** * Switch this stream to using a new socket. Any existing socket is <em>not</em> closed; it's * assumed that we are changing to a new socket that delegates to the original socket (e.g. SSL). * * @param socket the new socket to change to * @throws IOException if something goes wrong */ public void changeSocket(Socket socket) throws IOException { this.connection = socket; // Submitted by Jason Venner <jason@idiom.com>. Disable Nagle // as we are selective about flushing output only when we // really need to. connection.setTcpNoDelay(true); // Buffer sizes submitted by Sverre H Huseby <sverrehu@online.no> pg_input = new VisibleBufferedInputStream(connection.getInputStream(), 8192); pg_output = new BufferedOutputStream(connection.getOutputStream(), 8192); if (encoding != null) { setEncoding(encoding); } }
/** * Constructor: Connect to the PostgreSQL back end and return * a stream connection. * * @param host the hostname to connect to * @param port the port number that the postmaster is sitting on * @exception IOException if an IOException occurs below it. */ public PGStream(String host, int port) throws IOException { this.host = host; this.port = port; changeSocket(new Socket(host, port)); setEncoding(Encoding.getJVMEncoding("US-ASCII")); _int2buf = new byte[2]; _int4buf = new byte[4]; }
/** * Constructor: Connect to the PostgreSQL back end and return a stream connection. * * @param socketFactory socket factory to use when creating sockets * @param hostSpec the host and port to connect to * @param timeout timeout in milliseconds, or 0 if no timeout set * @throws IOException if an IOException occurs below it. */ public PGStream(SocketFactory socketFactory, HostSpec hostSpec, int timeout) throws IOException { this.socketFactory = socketFactory; this.hostSpec = hostSpec; Socket socket = socketFactory.createSocket(); if (!socket.isConnected()) { // When using a SOCKS proxy, the host might not be resolvable locally, // thus we defer resolution until the traffic reaches the proxy. If there // is no proxy, we must resolve the host to an IP to connect the socket. InetSocketAddress address = hostSpec.shouldResolve() ? new InetSocketAddress(hostSpec.getHost(), hostSpec.getPort()) : InetSocketAddress.createUnresolved(hostSpec.getHost(), hostSpec.getPort()); socket.connect(address, timeout); } changeSocket(socket); setEncoding(Encoding.getJVMEncoding("UTF-8")); _int2buf = new byte[2]; _int4buf = new byte[4]; }
value); pgStream.setEncoding(Encoding.getDatabaseEncoding(value)); } else if (!value.equalsIgnoreCase("UTF8") && !value.equalsIgnoreCase("UTF-8")) {
pgStream.setEncoding(Encoding.getDatabaseEncoding("UTF8"));
void setEncoding(Encoding encoding) throws IOException { pgStream.setEncoding(encoding); }
void setEncoding(Encoding encoding) throws IOException { pgStream.setEncoding(encoding); }
/** * Switch this stream to using a new socket. Any existing socket * is <em>not</em> closed; it's assumed that we are changing to * a new socket that delegates to the original socket (e.g. SSL). * * @param socket the new socket to change to * @throws IOException if something goes wrong */ public void changeSocket(Socket socket) throws IOException { this.connection = socket; // Submitted by Jason Venner <jason@idiom.com>. Disable Nagle // as we are selective about flushing output only when we // really need to. connection.setTcpNoDelay(true); // Buffer sizes submitted by Sverre H Huseby <sverrehu@online.no> pg_input = new VisibleBufferedInputStream(connection.getInputStream(), 8192); pg_output = new BufferedOutputStream(connection.getOutputStream(), 8192); if (encoding != null) setEncoding(encoding); }
/** * Switch this stream to using a new socket. Any existing socket * is <em>not</em> closed; it's assumed that we are changing to * a new socket that delegates to the original socket (e.g. SSL). * * @param socket the new socket to change to * @throws IOException if something goes wrong */ public void changeSocket(Socket socket) throws IOException { this.connection = socket; // Submitted by Jason Venner <jason@idiom.com>. Disable Nagle // as we are selective about flushing output only when we // really need to. connection.setTcpNoDelay(true); // Buffer sizes submitted by Sverre H Huseby <sverrehu@online.no> pg_input = new VisibleBufferedInputStream(connection.getInputStream(), 8192); pg_output = new BufferedOutputStream(connection.getOutputStream(), 8192); if (encoding != null) setEncoding(encoding); }
/** * Constructor: Connect to the PostgreSQL back end and return * a stream connection. * * @param host the hostname to connect to * @param port the port number that the postmaster is sitting on * @exception IOException if an IOException occurs below it. */ public PGStream(String host, int port) throws IOException { this.host = host; this.port = port; changeSocket(new Socket(host, port)); setEncoding(Encoding.getJVMEncoding("US-ASCII")); _int2buf = new byte[2]; _int4buf = new byte[4]; }
/** * Constructor: Connect to the PostgreSQL back end and return * a stream connection. * * @param host the hostname to connect to * @param port the port number that the postmaster is sitting on * @exception IOException if an IOException occurs below it. */ public PGStream(String host, int port) throws IOException { this.host = host; this.port = port; changeSocket(new Socket(host, port)); setEncoding(Encoding.getJVMEncoding("US-ASCII")); _int2buf = new byte[2]; _int4buf = new byte[4]; }
pgStream.setEncoding(Encoding.getDatabaseEncoding("UTF8"));
pgStream.setEncoding(Encoding.getDatabaseEncoding("UNICODE"));