本文整理了Java中java.io.BufferedReader.readChar()
方法的一些代码示例,展示了BufferedReader.readChar()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BufferedReader.readChar()
方法的具体详情如下:
包路径:java.io.BufferedReader
类名称:BufferedReader
方法名:readChar
暂无
代码示例来源: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: com.bugvm/bugvm-rt
/**
* 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: MobiVM/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: ibinti/bugvm
/**
* 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: com.jtransc/jtransc-rt
/**
* 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: com.gluonhq/robovm-rt
/**
* 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: com.mobidevelop.robovm/robovm-rt
/**
* 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: FlexoVM/flexovm
/**
* 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;
}
}
内容来源于网络,如有侵权,请联系作者删除!