congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
BufferedWriter.ensureOpen
Code IndexAdd Tabnine to your IDE (free)

How to use
ensureOpen
method
in
java.io.BufferedWriter

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

origin: org.apidesign.bck2brwsr/emul

/**
 * Flushes the output buffer to the underlying character stream, without
 * flushing the stream itself.  This method is non-private only so that it
 * may be invoked by PrintStream.
 */
void flushBuffer() throws IOException {
  synchronized (lock) {
    ensureOpen();
    if (nextChar == 0)
      return;
    out.write(cb, 0, nextChar);
    nextChar = 0;
  }
}
origin: jtulach/bck2brwsr

/**
 * Flushes the output buffer to the underlying character stream, without
 * flushing the stream itself.  This method is non-private only so that it
 * may be invoked by PrintStream.
 */
void flushBuffer() throws IOException {
  synchronized (lock) {
    ensureOpen();
    if (nextChar == 0)
      return;
    out.write(cb, 0, nextChar);
    nextChar = 0;
  }
}
origin: org.apidesign.bck2brwsr/emul

/**
 * Writes a single character.
 *
 * @exception  IOException  If an I/O error occurs
 */
public void write(int c) throws IOException {
  synchronized (lock) {
    ensureOpen();
    if (nextChar >= nChars)
      flushBuffer();
    cb[nextChar++] = (char) c;
  }
}
origin: jtulach/bck2brwsr

/**
 * Writes a single character.
 *
 * @exception  IOException  If an I/O error occurs
 */
public void write(int c) throws IOException {
  synchronized (lock) {
    ensureOpen();
    if (nextChar >= nChars)
      flushBuffer();
    cb[nextChar++] = (char) c;
  }
}
origin: org.apidesign.bck2brwsr/emul

/**
 * Writes a portion of a String.
 *
 * <p> If the value of the <tt>len</tt> parameter is negative then no
 * characters are written.  This is contrary to the specification of this
 * method in the {@linkplain java.io.Writer#write(java.lang.String,int,int)
 * superclass}, which requires that an {@link IndexOutOfBoundsException} be
 * thrown.
 *
 * @param  s     String to be written
 * @param  off   Offset from which to start reading characters
 * @param  len   Number of characters to be written
 *
 * @exception  IOException  If an I/O error occurs
 */
public void write(String s, int off, int len) throws IOException {
  synchronized (lock) {
    ensureOpen();
    int b = off, t = off + len;
    while (b < t) {
      int d = min(nChars - nextChar, t - b);
      s.getChars(b, b + d, cb, nextChar);
      b += d;
      nextChar += d;
      if (nextChar >= nChars)
        flushBuffer();
    }
  }
}
origin: jtulach/bck2brwsr

/**
 * Writes a portion of a String.
 *
 * <p> If the value of the <tt>len</tt> parameter is negative then no
 * characters are written.  This is contrary to the specification of this
 * method in the {@linkplain java.io.Writer#write(java.lang.String,int,int)
 * superclass}, which requires that an {@link IndexOutOfBoundsException} be
 * thrown.
 *
 * @param  s     String to be written
 * @param  off   Offset from which to start reading characters
 * @param  len   Number of characters to be written
 *
 * @exception  IOException  If an I/O error occurs
 */
public void write(String s, int off, int len) throws IOException {
  synchronized (lock) {
    ensureOpen();
    int b = off, t = off + len;
    while (b < t) {
      int d = min(nChars - nextChar, t - b);
      s.getChars(b, b + d, cb, nextChar);
      b += d;
      nextChar += d;
      if (nextChar >= nChars)
        flushBuffer();
    }
  }
}
origin: jtulach/bck2brwsr

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

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

Javadoc

Checks to make sure that the stream has not been closed

Popular methods of BufferedWriter

  • <init>
    Constructs a new BufferedWriter, providing out with size chars of buffer.
  • write
    Writes count characters starting at offset in buffer to this writer. If count is greater than this w
  • close
    Closes this writer. The contents of the buffer are flushed, the target writer is closed, and the buf
  • flush
    Flushes this writer. The contents of the buffer are committed to the target writer and it is then fl
  • newLine
    Writes a newline to this writer. On Android, this is "\n". The target writer may or may not be flush
  • append
  • checkNotClosed
  • flushInternal
    Flushes the internal buffer.
  • isClosed
    Indicates whether this writer is closed.
  • drain
  • flushBuffer
    Flushes the output buffer to the underlying character stream, without flushing the stream itself. Th
  • min
    Our own little min method, to avoid loading java.lang.Math if we've run out of file descriptors and
  • flushBuffer,
  • min

Popular in Java

  • Parsing JSON documents to java classes using gson
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (Timer)
  • getSystemService (Context)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • Socket (java.net)
    Provides a client-side TCP socket.
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • Best IntelliJ plugins
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