本文整理了Java中java.io.PrintStream.checkError()
方法的一些代码示例,展示了PrintStream.checkError()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PrintStream.checkError()
方法的具体详情如下:
包路径:java.io.PrintStream
类名称:PrintStream
方法名:checkError
[英]Flushes this stream and returns the value of the error flag.
[中]刷新此流并返回错误标志的值。
代码示例来源:origin: spockframework/spock
@Override
public boolean checkError() {
for (PrintStream stream : delegates) {
if (stream.checkError()) return true;
}
return false;
}
代码示例来源:origin: apache/zookeeper
private void throwExceptionOnError(String tag) throws IOException {
if (stream.checkError()) {
throw new IOException("Error serializing "+tag);
}
}
代码示例来源:origin: org.apache.zookeeper/zookeeper
private void throwExceptionOnError(String tag) throws IOException {
if (stream.checkError()) {
throw new IOException("Error serializing "+tag);
}
}
代码示例来源:origin: org.codehaus.plexus/plexus-utils
public void consumeLine( String line )
throws IOException
{
System.out.println( line );
if ( System.out.checkError() )
{
throw new IOException( String.format( "Failure printing line '%s' to stdout.", line ) );
}
}
代码示例来源:origin: apache/zookeeper
/**
* Copies from one stream to another.
*
* @param in
* InputStrem to read from
* @param out
* OutputStream to write to
* @param buffSize
* the size of the buffer
*/
public static void copyBytes(InputStream in, OutputStream out, int buffSize)
throws IOException {
PrintStream ps = out instanceof PrintStream ? (PrintStream) out : null;
byte buf[] = new byte[buffSize];
int bytesRead = in.read(buf);
while (bytesRead >= 0) {
out.write(buf, 0, bytesRead);
if ((ps != null) && ps.checkError()) {
throw new IOException("Unable to write to output stream.");
}
bytesRead = in.read(buf);
}
}
代码示例来源:origin: alibaba/jstorm
/**
* Copies from one stream to another.
*
* @param in InputStream to read from
* @param out OutputStream to write to
* @param buffSize the size of the buffer
*/
public static void copyBytes(InputStream in, OutputStream out, int buffSize)
throws IOException {
PrintStream ps = out instanceof PrintStream ? (PrintStream) out : null;
byte buf[] = new byte[buffSize];
int bytesRead = in.read(buf);
while (bytesRead >= 0) {
out.write(buf, 0, bytesRead);
if ((ps != null) && ps.checkError()) {
throw new IOException("Unable to write to output stream.");
}
bytesRead = in.read(buf);
}
}
代码示例来源:origin: vavr-io/vavr
/**
* Sends the string representations of this to the {@link PrintStream}.
* If this value consists of multiple elements, each element is displayed in a new line.
*
* @param out The PrintStream to write to
* @throws IllegalStateException if {@code PrintStream.checkError()} is true after writing to stream.
*/
@GwtIncompatible("java.io.PrintStream is not implemented")
default void out(PrintStream out) {
for (T t : this) {
out.println(String.valueOf(t));
if (out.checkError()) {
throw new IllegalStateException("Error writing to PrintStream");
}
}
}
代码示例来源:origin: apache/flink
while (bytesRead >= 0) {
out.write(buf, 0, bytesRead);
if ((ps != null) && ps.checkError()) {
throw new IOException("Unable to write to output stream.");
代码示例来源:origin: org.apache.hadoop/hadoop-common
/**
* Copies from one stream to another.
*
* @param in InputStrem to read from
* @param out OutputStream to write to
* @param buffSize the size of the buffer
*/
public static void copyBytes(InputStream in, OutputStream out, int buffSize)
throws IOException {
PrintStream ps = out instanceof PrintStream ? (PrintStream)out : null;
byte buf[] = new byte[buffSize];
int bytesRead = in.read(buf);
while (bytesRead >= 0) {
out.write(buf, 0, bytesRead);
if ((ps != null) && ps.checkError()) {
throw new IOException("Unable to write to output stream.");
}
bytesRead = in.read(buf);
}
}
代码示例来源:origin: org.apache.zookeeper/zookeeper
/**
* Copies from one stream to another.
*
* @param in
* InputStrem to read from
* @param out
* OutputStream to write to
* @param buffSize
* the size of the buffer
*/
public static void copyBytes(InputStream in, OutputStream out, int buffSize)
throws IOException {
PrintStream ps = out instanceof PrintStream ? (PrintStream) out : null;
byte buf[] = new byte[buffSize];
int bytesRead = in.read(buf);
while (bytesRead >= 0) {
out.write(buf, 0, bytesRead);
if ((ps != null) && ps.checkError()) {
throw new IOException("Unable to write to output stream.");
}
bytesRead = in.read(buf);
}
}
代码示例来源:origin: org.apache.hadoop/hadoop-common
/**
* If the sink isn't set to ignore errors, throw a {@link MetricsException}
* if the stream encountered an exception. The message parameter will be used
* as the new exception's message with the current file name
* ({@link #currentFilePath}) appended to it.
*
* @param message the exception message. The message will have a colon and
* the current file name ({@link #currentFilePath}) appended to it.
* @throws MetricsException thrown if there was an error and the sink isn't
* ignoring errors
*/
private void checkForErrors(String message)
throws MetricsException {
if (!ignoreError && currentOutStream.checkError()) {
throw new MetricsException(message + ": " + currentFilePath);
}
}
代码示例来源:origin: spotify/helios
if (out.checkError()) {
break;
代码示例来源:origin: spotify/helios
if (out.checkError()) {
break;
代码示例来源:origin: facebook/jcommon
boolean checkError() {
return delegate.checkError();
}
代码示例来源:origin: facebook/jcommon
@Override
public boolean checkError() {
return printStream.checkError();
}
代码示例来源:origin: apache/hive
if (out.checkError()) {
break;
代码示例来源:origin: stackoverflow.com
while(!System.out.checkError()) {
System.out.println("hi");
}
代码示例来源:origin: i2p/i2p.i2p
public void close() throws IOException {
_out.println(" }");
_out.println("}");
if (_out.checkError())
throw new IOException();
_out.close();
System.out.println(_count + " strings written to " + _name);
}
}
代码示例来源:origin: apache/accumulo
private static int checkTablets(ServerContext context, Iterator<TabletLocationState> scanner,
LiveTServerSet tservers) {
int offline = 0;
while (scanner.hasNext() && !System.out.checkError()) {
TabletLocationState locationState = scanner.next();
TabletState state = locationState.getState(tservers.getCurrentServers());
if (state != null && state != TabletState.HOSTED && context.getTableManager()
.getTableState(locationState.extent.getTableId()) != TableState.OFFLINE) {
System.out
.println(locationState + " is " + state + " #walogs:" + locationState.walogs.size());
offline++;
}
}
return offline;
}
}
代码示例来源:origin: adyliu/jafka
if (System.out.checkError()) {
System.err.println("Unable to write to standard out, closing consumer.");
formatter.close();
内容来源于网络,如有侵权,请联系作者删除!