Tabnine Logo
PrintStream.checkError
Code IndexAdd Tabnine to your IDE (free)

How to use
checkError
method
in
java.io.PrintStream

Best Java code snippets using java.io.PrintStream.checkError (Showing top 20 results out of 945)

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();
java.ioPrintStreamcheckError

Javadoc

Flushes this stream and returns the value of the error flag.

Popular methods of PrintStream

  • println
    Prints an array of characters and then terminate the line. This method behaves as though it invokes
  • print
    Prints an array of characters. The characters are converted into bytes according to the platform's d
  • <init>
  • printf
    Prints a formatted string. The behavior of this method is the same as this stream's #format(Locale,
  • flush
    Flushes the stream. This is done by writing any buffered output bytes to the underlying output strea
  • close
    Closes the stream. This is done by flushing the stream and then closing the underlying output stream
  • format
    Writes a string formatted by an intermediate Formatter to this stream using the specified locale, fo
  • write
  • append
  • setError
    Sets the error state of the stream to true. This method will cause subsequent invocations of #checkE
  • newline
    Put the line separator String onto the print stream.
  • ensureOpen
    Check to make sure that the stream has not been closed
  • newline,
  • ensureOpen,
  • newLine,
  • requireNonNull,
  • toCharset

Popular in Java

  • Updating database using SQL prepared statement
  • getSystemService (Context)
  • onRequestPermissionsResult (Fragment)
  • runOnUiThread (Activity)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • String (java.lang)
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • JCheckBox (javax.swing)
  • Top 12 Jupyter Notebook extensions
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