@Override public boolean checkError() { for (PrintStream stream : delegates) { if (stream.checkError()) return true; } return false; }
private void throwExceptionOnError(String tag) throws IOException { if (stream.checkError()) { throw new IOException("Error serializing "+tag); } }
private void throwExceptionOnError(String tag) throws IOException { if (stream.checkError()) { throw new IOException("Error serializing "+tag); } }
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 ) ); } }
/** * 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); } }
/** * 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); } }
/** * 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"); } } }
while (bytesRead >= 0) { out.write(buf, 0, bytesRead); if ((ps != null) && ps.checkError()) { throw new IOException("Unable to write to output stream.");
/** * 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); } }
/** * 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); } }
/** * 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); } }
if (out.checkError()) { break;
if (out.checkError()) { break;
boolean checkError() { return delegate.checkError(); }
@Override public boolean checkError() { return printStream.checkError(); }
if (out.checkError()) { break;
while(!System.out.checkError()) { System.out.println("hi"); }
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); } }
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; } }
if (System.out.checkError()) { System.err.println("Unable to write to standard out, closing consumer."); formatter.close();