Codota Logo
VisibleBufferedInputStream.ensureBytes
Code IndexAdd Codota to your IDE (free)

How to use
ensureBytes
method
in
org.postgresql.core.VisibleBufferedInputStream

Best Java code snippets using org.postgresql.core.VisibleBufferedInputStream.ensureBytes (Showing top 16 results out of 315)

  • Common ways to obtain VisibleBufferedInputStream
private void myMethod () {
VisibleBufferedInputStream v =
  • Codota IconSocket socket;new VisibleBufferedInputStream(socket.getInputStream(), int1)
  • Smart code suggestions by Codota
}
origin: org.postgresql/postgresql

/**
 * Reads a byte from the buffer without advancing the index pointer.
 *
 * @return byte from the buffer without advancing the index pointer
 * @throws IOException if something wrong happens
 */
public int peek() throws IOException {
 if (ensureBytes(1)) {
  return buffer[index] & 0xFF;
 }
 return -1;
}
origin: postgresql/postgresql

/**
 * Reads a byte from the buffer without advancing the index pointer.
 */
public int peek() throws IOException {
  if (ensureBytes(1)) {
    return buffer[index] & 0xFF;
  }
  return -1;
}
origin: org.postgresql/postgresql

/**
 * {@inheritDoc}
 */
public int read() throws IOException {
 if (ensureBytes(1)) {
  return buffer[index++] & 0xFF;
 }
 return -1;
}
origin: postgresql/postgresql

/**
 * {@inheritDoc}
 */
public int read() throws IOException {
  if (ensureBytes(1)) {
    return buffer[index++] & 0xFF;
  }
  return -1;
}
origin: org.postgresql/postgresql

ensureBytes(len);
avail = endIndex - index;
origin: postgresql/postgresql

ensureBytes(len);
avail = endIndex - index;
origin: org.postgresql/postgresql

/**
 * Receives a fixed-size string from the backend.
 *
 * @param len the length of the string to receive, in bytes.
 * @return the decoded string
 * @throws IOException if something wrong happens
 */
public String receiveString(int len) throws IOException {
 if (!pg_input.ensureBytes(len)) {
  throw new EOFException();
 }
 String res = encoding.decode(pg_input.getBuffer(), pg_input.getIndex(), len);
 pg_input.skip(len);
 return res;
}
origin: postgresql/postgresql

/**
 * Receives a fixed-size string from the backend.
 *
 * @param len the length of the string to receive, in bytes.
 * @return the decoded string
 */
public String ReceiveString(int len) throws IOException {
  if (!pg_input.ensureBytes(len)) {
    throw new EOFException();
  }
  String res = encoding.decode(pg_input.getBuffer(), pg_input.getIndex(),
                 len);
  pg_input.skip(len);
  return res;
}
origin: org.postgresql/postgresql

/**
 * Receives a fixed-size string from the backend, and tries to avoid "UTF-8 decode failed"
 * errors.
 *
 * @param len the length of the string to receive, in bytes.
 * @return the decoded string
 * @throws IOException if something wrong happens
 */
public EncodingPredictor.DecodeResult receiveErrorString(int len) throws IOException {
 if (!pg_input.ensureBytes(len)) {
  throw new EOFException();
 }
 EncodingPredictor.DecodeResult res;
 try {
  String value = encoding.decode(pg_input.getBuffer(), pg_input.getIndex(), len);
  // no autodetect warning as the message was converted on its own
  res = new EncodingPredictor.DecodeResult(value, null);
 } catch (IOException e) {
  res = EncodingPredictor.decode(pg_input.getBuffer(), pg_input.getIndex(), len);
  if (res == null) {
   Encoding enc = Encoding.defaultEncoding();
   String value = enc.decode(pg_input.getBuffer(), pg_input.getIndex(), len);
   res = new EncodingPredictor.DecodeResult(value, enc.name());
  }
 }
 pg_input.skip(len);
 return res;
}
origin: org.ancoron.postgresql/org.postgresql

/**
 * Reads a byte from the buffer without advancing the index pointer.
 */
public int peek() throws IOException {
  if (ensureBytes(1)) {
    return buffer[index] & 0xFF;
  }
  return -1;
}
origin: org.ancoron.postgresql/org.postgresql

/**
 * {@inheritDoc}
 */
public int read() throws IOException {
  if (ensureBytes(1)) {
    return buffer[index++] & 0xFF;
  }
  return -1;
}
origin: org.ancoron.postgresql/org.postgresql.osgi

/**
 * {@inheritDoc}
 */
public int read() throws IOException {
  if (ensureBytes(1)) {
    return buffer[index++] & 0xFF;
  }
  return -1;
}
origin: org.ancoron.postgresql/org.postgresql

ensureBytes(len);
avail = endIndex - index;
origin: org.ancoron.postgresql/org.postgresql.osgi

ensureBytes(len);
avail = endIndex - index;
origin: org.ancoron.postgresql/org.postgresql.osgi

/**
 * Receives a fixed-size string from the backend.
 *
 * @param len the length of the string to receive, in bytes.
 * @return the decoded string
 */
public String ReceiveString(int len) throws IOException {
  if (!pg_input.ensureBytes(len)) {
    throw new EOFException();
  }
  String res = encoding.decode(pg_input.getBuffer(), pg_input.getIndex(),
                 len);
  pg_input.skip(len);
  return res;
}
origin: org.ancoron.postgresql/org.postgresql

/**
 * Receives a fixed-size string from the backend.
 *
 * @param len the length of the string to receive, in bytes.
 * @return the decoded string
 */
public String ReceiveString(int len) throws IOException {
  if (!pg_input.ensureBytes(len)) {
    throw new EOFException();
  }
  String res = encoding.decode(pg_input.getBuffer(), pg_input.getIndex(),
                 len);
  pg_input.skip(len);
  return res;
}
org.postgresql.coreVisibleBufferedInputStreamensureBytes

Javadoc

Ensures that the buffer contains at least n bytes. This method invalidates the buffer and index fields.

Popular methods of VisibleBufferedInputStream

  • <init>
    Creates a new buffer around the given stream.
  • available
  • close
  • compact
    Compacts the unread bytes of the buffer to the beginning of the buffer.
  • doubleBuffer
    Doubles the size of the buffer.
  • getBuffer
    Returns direct handle to the used buffer. Use the #ensureBytesto prefill required bytes the buffer a
  • getIndex
    Returns the current read position in the buffer.
  • moveBufferTo
    Moves bytes from the buffer to the begining of the destination buffer. Also sets the index and endIn
  • read
  • readMore
    Reads more bytes into the buffer.
  • scanCStringLength
    Scans the length of the next null terminated string (C-style string) from the stream.
  • skip
  • scanCStringLength,
  • skip,
  • peek

Popular in Java

  • Start an intent from android
  • setRequestProperty (URLConnection)
  • orElseThrow (Optional)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • DecimalFormat (java.text)
    DecimalFormat is a concrete subclass ofNumberFormat that formats decimal numbers. It has a variety o
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • ImageIO (javax.imageio)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now