java.io.BufferedReader.checkNotClosed()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中java.io.BufferedReader.checkNotClosed()方法的一些代码示例,展示了BufferedReader.checkNotClosed()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BufferedReader.checkNotClosed()方法的具体详情如下:
包路径:java.io.BufferedReader
类名称:BufferedReader
方法名:checkNotClosed

BufferedReader.checkNotClosed介绍

暂无

代码示例

代码示例来源:origin: robovm/robovm

/**
 * Indicates whether this reader is ready to be read without blocking.
 *
 * @return {@code true} if this reader will not block when {@code read} is
 *         called, {@code false} if unknown or blocking will occur.
 * @throws IOException
 *             if this reader is closed or some other I/O error occurs.
 * @see #read()
 * @see #read(char[], int, int)
 * @see #readLine()
 */
@Override
public boolean ready() throws IOException {
  synchronized (lock) {
    checkNotClosed();
    return ((end - pos) > 0) || in.ready();
  }
}

代码示例来源:origin: robovm/robovm

/**
 * Resets this reader's position to the last {@code mark()} location.
 * Invocations of {@code read()} and {@code skip()} will occur from this new
 * location.
 *
 * @throws IOException
 *             if this reader is closed or no mark has been set.
 * @see #mark(int)
 * @see #markSupported()
 */
@Override
public void reset() throws IOException {
  synchronized (lock) {
    checkNotClosed();
    if (mark == -1) {
      throw new IOException("Invalid mark");
    }
    this.pos = mark;
    this.lastWasCR = this.markedLastWasCR;
  }
}

代码示例来源:origin: robovm/robovm

/**
 * Sets a mark position in this reader. The parameter {@code markLimit}
 * indicates how many characters can be read before the mark is invalidated.
 * Calling {@code reset()} will reposition the reader back to the marked
 * position if {@code markLimit} has not been surpassed.
 *
 * @param markLimit
 *            the number of characters that can be read before the mark is
 *            invalidated.
 * @throws IllegalArgumentException
 *             if {@code markLimit < 0}.
 * @throws IOException
 *             if an error occurs while setting a mark in this reader.
 * @see #markSupported()
 * @see #reset()
 */
@Override
public void mark(int markLimit) throws IOException {
  if (markLimit < 0) {
    throw new IllegalArgumentException("markLimit < 0:" + markLimit);
  }
  synchronized (lock) {
    checkNotClosed();
    this.markLimit = markLimit;
    this.mark = pos;
    this.markedLastWasCR = lastWasCR;
  }
}

代码示例来源:origin: robovm/robovm

checkNotClosed();
if (end - pos >= charCount) {
  pos += charCount;

代码示例来源:origin: robovm/robovm

checkNotClosed();

代码示例来源:origin: robovm/robovm

/**
 * Reads a single character from this reader and returns it with the two
 * higher-order bytes set to 0. If possible, BufferedReader returns a
 * character from the buffer. If there are no characters available in the
 * buffer, it fills the buffer and then returns a character. It returns -1
 * if there are no more characters in the source reader.
 *
 * @return the character read or -1 if the end of the source reader has been
 *         reached.
 * @throws IOException
 *             if this reader is closed or some other I/O error occurs.
 */
@Override
public int read() throws IOException {
  synchronized (lock) {
    checkNotClosed();
    int ch = readChar();
    if (lastWasCR && ch == '\n') {
      ch = readChar();
    }
    lastWasCR = false;
    return ch;
  }
}

代码示例来源:origin: robovm/robovm

public int read(char[] buffer, int offset, int length) throws IOException {
  synchronized (lock) {
    checkNotClosed();
    Arrays.checkOffsetAndCount(buffer.length, offset, length);
    if (length == 0) {

代码示例来源:origin: MobiVM/robovm

/**
 * Indicates whether this reader is ready to be read without blocking.
 *
 * @return {@code true} if this reader will not block when {@code read} is
 *         called, {@code false} if unknown or blocking will occur.
 * @throws IOException
 *             if this reader is closed or some other I/O error occurs.
 * @see #read()
 * @see #read(char[], int, int)
 * @see #readLine()
 */
@Override
public boolean ready() throws IOException {
  synchronized (lock) {
    checkNotClosed();
    return ((end - pos) > 0) || in.ready();
  }
}

代码示例来源:origin: ibinti/bugvm

/**
 * Indicates whether this reader is ready to be read without blocking.
 *
 * @return {@code true} if this reader will not block when {@code read} is
 *         called, {@code false} if unknown or blocking will occur.
 * @throws IOException
 *             if this reader is closed or some other I/O error occurs.
 * @see #read()
 * @see #read(char[], int, int)
 * @see #readLine()
 */
@Override
public boolean ready() throws IOException {
  synchronized (lock) {
    checkNotClosed();
    return ((end - pos) > 0) || in.ready();
  }
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Indicates whether this reader is ready to be read without blocking.
 *
 * @return {@code true} if this reader will not block when {@code read} is
 *         called, {@code false} if unknown or blocking will occur.
 * @throws IOException
 *             if this reader is closed or some other I/O error occurs.
 * @see #read()
 * @see #read(char[], int, int)
 * @see #readLine()
 */
@Override
public boolean ready() throws IOException {
  synchronized (lock) {
    checkNotClosed();
    return ((end - pos) > 0) || in.ready();
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Indicates whether this reader is ready to be read without blocking.
 *
 * @return {@code true} if this reader will not block when {@code read} is
 *         called, {@code false} if unknown or blocking will occur.
 * @throws IOException
 *             if this reader is closed or some other I/O error occurs.
 * @see #read()
 * @see #read(char[], int, int)
 * @see #readLine()
 */
@Override
public boolean ready() throws IOException {
  synchronized (lock) {
    checkNotClosed();
    return ((end - pos) > 0) || in.ready();
  }
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Indicates whether this reader is ready to be read without blocking.
 *
 * @return {@code true} if this reader will not block when {@code read} is
 *         called, {@code false} if unknown or blocking will occur.
 * @throws IOException
 *             if this reader is closed or some other I/O error occurs.
 * @see #read()
 * @see #read(char[], int, int)
 * @see #readLine()
 */
@Override
public boolean ready() throws IOException {
  synchronized (lock) {
    checkNotClosed();
    return ((end - pos) > 0) || in.ready();
  }
}

代码示例来源:origin: com.jtransc/jtransc-rt

/**
 * Indicates whether this reader is ready to be read without blocking.
 *
 * @return {@code true} if this reader will not block when {@code read} is
 *         called, {@code false} if unknown or blocking will occur.
 * @throws IOException
 *             if this reader is closed or some other I/O error occurs.
 * @see #read()
 * @see #read(char[], int, int)
 * @see #readLine()
 */
@Override
public boolean ready() throws IOException {
  synchronized (lock) {
    checkNotClosed();
    return ((end - pos) > 0) || in.ready();
  }
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Indicates whether this reader is ready to be read without blocking.
 *
 * @return {@code true} if this reader will not block when {@code read} is
 *         called, {@code false} if unknown or blocking will occur.
 * @throws IOException
 *             if this reader is closed or some other I/O error occurs.
 * @see #read()
 * @see #read(char[], int, int)
 * @see #readLine()
 */
@Override
public boolean ready() throws IOException {
  synchronized (lock) {
    checkNotClosed();
    return ((end - pos) > 0) || in.ready();
  }
}

代码示例来源:origin: ibinti/bugvm

/**
 * Resets this reader's position to the last {@code mark()} location.
 * Invocations of {@code read()} and {@code skip()} will occur from this new
 * location.
 *
 * @throws IOException
 *             if this reader is closed or no mark has been set.
 * @see #mark(int)
 * @see #markSupported()
 */
@Override
public void reset() throws IOException {
  synchronized (lock) {
    checkNotClosed();
    if (mark == -1) {
      throw new IOException("Invalid mark");
    }
    this.pos = mark;
    this.lastWasCR = this.markedLastWasCR;
  }
}

代码示例来源:origin: MobiVM/robovm

/**
 * Resets this reader's position to the last {@code mark()} location.
 * Invocations of {@code read()} and {@code skip()} will occur from this new
 * location.
 *
 * @throws IOException
 *             if this reader is closed or no mark has been set.
 * @see #mark(int)
 * @see #markSupported()
 */
@Override
public void reset() throws IOException {
  synchronized (lock) {
    checkNotClosed();
    if (mark == -1) {
      throw new IOException("Invalid mark");
    }
    this.pos = mark;
    this.lastWasCR = this.markedLastWasCR;
  }
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Resets this reader's position to the last {@code mark()} location.
 * Invocations of {@code read()} and {@code skip()} will occur from this new
 * location.
 *
 * @throws IOException
 *             if this reader is closed or no mark has been set.
 * @see #mark(int)
 * @see #markSupported()
 */
@Override
public void reset() throws IOException {
  synchronized (lock) {
    checkNotClosed();
    if (mark == -1) {
      throw new IOException("Invalid mark");
    }
    this.pos = mark;
    this.lastWasCR = this.markedLastWasCR;
  }
}

代码示例来源:origin: com.jtransc/jtransc-rt

/**
 * Resets this reader's position to the last {@code mark()} location.
 * Invocations of {@code read()} and {@code skip()} will occur from this new
 * location.
 *
 * @throws IOException
 *             if this reader is closed or no mark has been set.
 * @see #mark(int)
 * @see #markSupported()
 */
@Override
public void reset() throws IOException {
  synchronized (lock) {
    checkNotClosed();
    if (mark == -1) {
      throw new IOException("Invalid mark");
    }
    this.pos = mark;
    this.lastWasCR = this.markedLastWasCR;
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Resets this reader's position to the last {@code mark()} location.
 * Invocations of {@code read()} and {@code skip()} will occur from this new
 * location.
 *
 * @throws IOException
 *             if this reader is closed or no mark has been set.
 * @see #mark(int)
 * @see #markSupported()
 */
@Override
public void reset() throws IOException {
  synchronized (lock) {
    checkNotClosed();
    if (mark == -1) {
      throw new IOException("Invalid mark");
    }
    this.pos = mark;
    this.lastWasCR = this.markedLastWasCR;
  }
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Resets this reader's position to the last {@code mark()} location.
 * Invocations of {@code read()} and {@code skip()} will occur from this new
 * location.
 *
 * @throws IOException
 *             if this reader is closed or no mark has been set.
 * @see #mark(int)
 * @see #markSupported()
 */
@Override
public void reset() throws IOException {
  synchronized (lock) {
    checkNotClosed();
    if (mark == -1) {
      throw new IOException("Invalid mark");
    }
    this.pos = mark;
    this.lastWasCR = this.markedLastWasCR;
  }
}

相关文章