Tabnine Logo
BufferedReader.ensureOpen
Code IndexAdd Tabnine to your IDE (free)

How to use
ensureOpen
method
in
java.io.BufferedReader

Best Java code snippets using java.io.BufferedReader.ensureOpen (Showing top 15 results out of 315)

origin: jtulach/bck2brwsr

/**
 * Resets the stream to the most recent mark.
 *
 * @exception  IOException  If the stream has never been marked,
 *                          or if the mark has been invalidated
 */
public void reset() throws IOException {
  synchronized (lock) {
    ensureOpen();
    if (markedChar < 0)
      throw new IOException((markedChar == INVALIDATED)
                 ? "Mark invalid"
                 : "Stream not marked");
    nextChar = markedChar;
    skipLF = markedSkipLF;
  }
}
origin: org.apidesign.bck2brwsr/emul

/**
 * Resets the stream to the most recent mark.
 *
 * @exception  IOException  If the stream has never been marked,
 *                          or if the mark has been invalidated
 */
public void reset() throws IOException {
  synchronized (lock) {
    ensureOpen();
    if (markedChar < 0)
      throw new IOException((markedChar == INVALIDATED)
                 ? "Mark invalid"
                 : "Stream not marked");
    nextChar = markedChar;
    skipLF = markedSkipLF;
  }
}
origin: jtulach/bck2brwsr

/**
 * Marks the present position in the stream.  Subsequent calls to reset()
 * will attempt to reposition the stream to this point.
 *
 * @param readAheadLimit   Limit on the number of characters that may be
 *                         read while still preserving the mark. An attempt
 *                         to reset the stream after reading characters
 *                         up to this limit or beyond may fail.
 *                         A limit value larger than the size of the input
 *                         buffer will cause a new buffer to be allocated
 *                         whose size is no smaller than limit.
 *                         Therefore large values should be used with care.
 *
 * @exception  IllegalArgumentException  If readAheadLimit is < 0
 * @exception  IOException  If an I/O error occurs
 */
public void mark(int readAheadLimit) throws IOException {
  if (readAheadLimit < 0) {
    throw new IllegalArgumentException("Read-ahead limit < 0");
  }
  synchronized (lock) {
    ensureOpen();
    this.readAheadLimit = readAheadLimit;
    markedChar = nextChar;
    markedSkipLF = skipLF;
  }
}
origin: org.apidesign.bck2brwsr/emul

/**
 * Marks the present position in the stream.  Subsequent calls to reset()
 * will attempt to reposition the stream to this point.
 *
 * @param readAheadLimit   Limit on the number of characters that may be
 *                         read while still preserving the mark. An attempt
 *                         to reset the stream after reading characters
 *                         up to this limit or beyond may fail.
 *                         A limit value larger than the size of the input
 *                         buffer will cause a new buffer to be allocated
 *                         whose size is no smaller than limit.
 *                         Therefore large values should be used with care.
 *
 * @exception  IllegalArgumentException  If readAheadLimit is < 0
 * @exception  IOException  If an I/O error occurs
 */
public void mark(int readAheadLimit) throws IOException {
  if (readAheadLimit < 0) {
    throw new IllegalArgumentException("Read-ahead limit < 0");
  }
  synchronized (lock) {
    ensureOpen();
    this.readAheadLimit = readAheadLimit;
    markedChar = nextChar;
    markedSkipLF = skipLF;
  }
}
origin: org.apidesign.bck2brwsr/emul

/**
 * Reads a single character.
 *
 * @return The character read, as an integer in the range
 *         0 to 65535 (<tt>0x00-0xffff</tt>), or -1 if the
 *         end of the stream has been reached
 * @exception  IOException  If an I/O error occurs
 */
public int read() throws IOException {
  synchronized (lock) {
    ensureOpen();
    for (;;) {
      if (nextChar >= nChars) {
        fill();
        if (nextChar >= nChars)
          return -1;
      }
      if (skipLF) {
        skipLF = false;
        if (cb[nextChar] == '\n') {
          nextChar++;
          continue;
        }
      }
      return cb[nextChar++];
    }
  }
}
origin: jtulach/bck2brwsr

/**
 * Tells whether this stream is ready to be read.  A buffered character
 * stream is ready if the buffer is not empty, or if the underlying
 * character stream is ready.
 *
 * @exception  IOException  If an I/O error occurs
 */
public boolean ready() throws IOException {
  synchronized (lock) {
    ensureOpen();
    /*
     * If newline needs to be skipped and the next char to be read
     * is a newline character, then just skip it right away.
     */
    if (skipLF) {
      /* Note that in.ready() will return true if and only if the next
       * read on the stream will not block.
       */
      if (nextChar >= nChars && in.ready()) {
        fill();
      }
      if (nextChar < nChars) {
        if (cb[nextChar] == '\n')
          nextChar++;
        skipLF = false;
      }
    }
    return (nextChar < nChars) || in.ready();
  }
}
origin: jtulach/bck2brwsr

/**
 * Reads a single character.
 *
 * @return The character read, as an integer in the range
 *         0 to 65535 (<tt>0x00-0xffff</tt>), or -1 if the
 *         end of the stream has been reached
 * @exception  IOException  If an I/O error occurs
 */
public int read() throws IOException {
  synchronized (lock) {
    ensureOpen();
    for (;;) {
      if (nextChar >= nChars) {
        fill();
        if (nextChar >= nChars)
          return -1;
      }
      if (skipLF) {
        skipLF = false;
        if (cb[nextChar] == '\n') {
          nextChar++;
          continue;
        }
      }
      return cb[nextChar++];
    }
  }
}
origin: org.apidesign.bck2brwsr/emul

/**
 * Tells whether this stream is ready to be read.  A buffered character
 * stream is ready if the buffer is not empty, or if the underlying
 * character stream is ready.
 *
 * @exception  IOException  If an I/O error occurs
 */
public boolean ready() throws IOException {
  synchronized (lock) {
    ensureOpen();
    /*
     * If newline needs to be skipped and the next char to be read
     * is a newline character, then just skip it right away.
     */
    if (skipLF) {
      /* Note that in.ready() will return true if and only if the next
       * read on the stream will not block.
       */
      if (nextChar >= nChars && in.ready()) {
        fill();
      }
      if (nextChar < nChars) {
        if (cb[nextChar] == '\n')
          nextChar++;
        skipLF = false;
      }
    }
    return (nextChar < nChars) || in.ready();
  }
}
origin: org.apidesign.bck2brwsr/emul

ensureOpen();
long r = n;
while (r > 0) {
origin: jtulach/bck2brwsr

ensureOpen();
long r = n;
while (r > 0) {
origin: org.apidesign.bck2brwsr/emul

ensureOpen();
boolean omitLF = ignoreLF || skipLF;
origin: stackoverflow.com

ensureOpen();
boolean omitLF = ignoreLF || skipLF;
origin: jtulach/bck2brwsr

ensureOpen();
boolean omitLF = ignoreLF || skipLF;
origin: org.apidesign.bck2brwsr/emul

ensureOpen();
if ((off < 0) || (off > cbuf.length) || (len < 0) ||
  ((off + len) > cbuf.length) || ((off + len) < 0)) {
origin: jtulach/bck2brwsr

ensureOpen();
if ((off < 0) || (off > cbuf.length) || (len < 0) ||
  ((off + len) > cbuf.length) || ((off + len) < 0)) {
java.ioBufferedReaderensureOpen

Javadoc

Checks to make sure that the stream has not been closed

Popular methods of BufferedReader

  • <init>
    Creates a buffering character-input stream that uses an input buffer of the specified size.
  • readLine
    Reads a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carr
  • close
    Closes this reader. This implementation closes the buffered source reader and releases the buffer. N
  • read
    Reads characters into a portion of an array. This method implements the general contract of the corr
  • lines
  • ready
    Tells whether this stream is ready to be read. A buffered character stream is ready if the buffer is
  • reset
    Resets the stream to the most recent mark.
  • mark
    Marks the present position in the stream. Subsequent calls to reset() will attempt to reposition the
  • skip
    Skips characters.
  • markSupported
    Tells whether this stream supports the mark() operation, which it does.
  • checkNotClosed
  • chompNewline
    Peeks at the next input character, refilling the buffer if necessary. If this character is a newline
  • checkNotClosed,
  • chompNewline,
  • fillBuf,
  • isClosed,
  • maybeSwallowLF,
  • readChar,
  • fill,
  • read1

Popular in Java

  • Reading from database using SQL prepared statement
  • startActivity (Activity)
  • findViewById (Activity)
  • onRequestPermissionsResult (Fragment)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Sublime Text for Python
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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