Tabnine Logo
VisibleBufferedInputStream.doubleBuffer
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: org.postgresql/postgresql

/**
 * Reads more bytes into the buffer.
 *
 * @param wanted How much should be at least read.
 * @return True if at least some bytes were read.
 * @throws IOException If reading of the wrapped stream failed.
 */
private boolean readMore(int wanted) throws IOException {
 if (endIndex == index) {
  index = 0;
  endIndex = 0;
 }
 int canFit = buffer.length - endIndex;
 if (canFit < wanted) {
  // would the wanted bytes fit if we compacted the buffer
  // and still leave some slack
  if (index + canFit > wanted + MINIMUM_READ) {
   compact();
  } else {
   doubleBuffer();
  }
  canFit = buffer.length - endIndex;
 }
 int read = wrapped.read(buffer, endIndex, canFit);
 if (read < 0) {
  return false;
 }
 endIndex += read;
 return true;
}
origin: postgresql/postgresql

/**
 * Reads more bytes into the buffer.
 * 
 * @param wanted How much should be at least read.
 * @return True if at least some bytes were read.
 * @throws IOException If reading of the wrapped stream failed.
 */
private boolean readMore(int wanted) throws IOException {
  if (endIndex == index) {
    index = 0;
    endIndex = 0;
  }
  int canFit = buffer.length - endIndex;
  if (canFit < wanted) {
    // would the wanted bytes fit if we compacted the buffer
    // and still leave some slack
    if (index + canFit > wanted + MINIMUM_READ) {
      compact();
    } else {
      doubleBuffer();
    }
    canFit = buffer.length - endIndex;
  }
  int read = wrapped.read(buffer, endIndex, canFit);
  if (read < 0) {
    return false;
  }
  endIndex += read;
  return true;
}
origin: org.ancoron.postgresql/org.postgresql

/**
 * Reads more bytes into the buffer.
 * 
 * @param wanted How much should be at least read.
 * @return True if at least some bytes were read.
 * @throws IOException If reading of the wrapped stream failed.
 */
private boolean readMore(int wanted) throws IOException {
  if (endIndex == index) {
    index = 0;
    endIndex = 0;
  }
  int canFit = buffer.length - endIndex;
  if (canFit < wanted) {
    // would the wanted bytes fit if we compacted the buffer
    // and still leave some slack
    if (index + canFit > wanted + MINIMUM_READ) {
      compact();
    } else {
      doubleBuffer();
    }
    canFit = buffer.length - endIndex;
  }
  int read = wrapped.read(buffer, endIndex, canFit);
  if (read < 0) {
    return false;
  }
  endIndex += read;
  return true;
}
origin: org.ancoron.postgresql/org.postgresql.osgi

/**
 * Reads more bytes into the buffer.
 * 
 * @param wanted How much should be at least read.
 * @return True if at least some bytes were read.
 * @throws IOException If reading of the wrapped stream failed.
 */
private boolean readMore(int wanted) throws IOException {
  if (endIndex == index) {
    index = 0;
    endIndex = 0;
  }
  int canFit = buffer.length - endIndex;
  if (canFit < wanted) {
    // would the wanted bytes fit if we compacted the buffer
    // and still leave some slack
    if (index + canFit > wanted + MINIMUM_READ) {
      compact();
    } else {
      doubleBuffer();
    }
    canFit = buffer.length - endIndex;
  }
  int read = wrapped.read(buffer, endIndex, canFit);
  if (read < 0) {
    return false;
  }
  endIndex += read;
  return true;
}
org.postgresql.coreVisibleBufferedInputStreamdoubleBuffer

Javadoc

Doubles the size of the buffer.

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.
  • ensureBytes
    Ensures that the buffer contains at least n bytes. This method invalidates the buffer and index fiel
  • 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

  • Making http requests using okhttp
  • getApplicationContext (Context)
  • findViewById (Activity)
  • getContentResolver (Context)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • JList (javax.swing)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now