/** * Receives a single character from the backend, without advancing the current protocol stream * position. * * @return the character received * @throws IOException if an I/O Error occurs */ public int peekChar() throws IOException { int c = pg_input.peek(); if (c < 0) { throw new EOFException(); } return c; }
/** * Receives a single character from the backend, without * advancing the current protocol stream position. * * @return the character received * @exception IOException if an I/O Error occurs */ public int PeekChar() throws IOException { int c = pg_input.peek(); if (c < 0) throw new EOFException(); return c; }
/** * Check for pending backend messages without blocking. Might return false when there actually are * messages waiting, depending on the characteristics of the underlying socket. This is used to * detect asynchronous notifies from the backend, when available. * * @return true if there is a pending backend message * @throws IOException if something wrong happens */ public boolean hasMessagePending() throws IOException { if (pg_input.available() > 0) { return true; } // In certain cases, available returns 0, yet there are bytes int soTimeout = getNetworkTimeout(); setNetworkTimeout(1); try { return pg_input.peek() != -1; } catch (SocketTimeoutException e) { return false; } finally { setNetworkTimeout(soTimeout); } }
/** * Receives a single character from the backend, without * advancing the current protocol stream position. * * @return the character received * @exception IOException if an I/O Error occurs */ public int PeekChar() throws IOException { int c = pg_input.peek(); if (c < 0) throw new EOFException(); return c; }