/** * Ensures that all pending data is sent out to the target stream. It also * flushes the target stream. If an I/O error occurs, this stream's error * state is set to {@code true}. */ @Override public synchronized void flush() { if (out != null) { try { out.flush(); return; } catch (IOException e) { // Ignored, fall through to setError } } setError(); }
/** * Closes this print stream. Flushes this stream and then closes the target * stream. If an I/O error occurs, this stream's error state is set to * {@code true}. */ @Override public synchronized void close() { flush(); if (out != null) { try { out.close(); out = null; } catch (IOException e) { setError(); } } }
/** * Writes one byte to the target stream. Only the least significant byte of * the integer {@code oneByte} is written. This stream is flushed if * {@code oneByte} is equal to the character {@code '\n'} and this stream is * set to autoFlush. * <p> * This stream's error flag is set to {@code true} if it is closed or an I/O * error occurs. * * @param oneByte * the byte to be written */ @Override public synchronized void write(int oneByte) { if (out == null) { setError(); return; } try { out.write(oneByte); int b = oneByte & 0xFF; // 0x0A is ASCII newline, 0x15 is EBCDIC newline. boolean isNewline = b == 0x0A || b == 0x15; if (autoFlush && isNewline) { flush(); } } catch (IOException e) { setError(); } }
@Override protected void setError() { super.setError(); }
@Override protected void setError() { super.setError(); }
public void flush() { try { out.flush(); } catch (IOException e) { setError(); } }
public void write(byte[] buf, int off, int len) { try { out.write(buf, off, len); } catch (IOException e) { setError(); } }
public void write(String str) { try { out.write(str); } catch (IOException e) { setError(); } }
public void print(String s) { try { out.write(s); } catch (IOException e) { setError(); } }
public void write(int b) { try { out.write(b); } catch (IOException e) { setError(); } }
/** * Ensures that all pending data is sent out to the target stream. It also * flushes the target stream. If an I/O error occurs, this stream's error * state is set to {@code true}. */ @Override public synchronized void flush() { if (out != null) { try { out.flush(); return; } catch (IOException e) { // Ignored, fall through to setError } } setError(); }
/** * Ensures that all pending data is sent out to the target stream. It also * flushes the target stream. If an I/O error occurs, this stream's error * state is set to {@code true}. */ @Override public synchronized void flush() { if (out != null) { try { out.flush(); return; } catch (IOException e) { // Ignored, fall through to setError } } setError(); }
/** * Ensures that all pending data is sent out to the target stream. It also * flushes the target stream. If an I/O error occurs, this stream's error * state is set to {@code true}. */ @Override public synchronized void flush() { if (out != null) { try { out.flush(); return; } catch (IOException e) { // Ignored, fall through to setError } } setError(); }
/** * Closes this print stream. Flushes this stream and then closes the target * stream. If an I/O error occurs, this stream's error state is set to * {@code true}. */ @Override public synchronized void close() { flush(); if (out != null) { try { out.close(); out = null; } catch (IOException e) { setError(); } } }
/** * Closes this print stream. Flushes this stream and then closes the target * stream. If an I/O error occurs, this stream's error state is set to * {@code true}. */ @Override public synchronized void close() { flush(); if (out != null) { try { out.close(); out = null; } catch (IOException e) { setError(); } } }
/** * Closes this print stream. Flushes this stream and then closes the target * stream. If an I/O error occurs, this stream's error state is set to * {@code true}. */ @Override public synchronized void close() { flush(); if (out != null) { try { out.close(); out = null; } catch (IOException e) { setError(); } } }
/** * Closes this print stream. Flushes this stream and then closes the target * stream. If an I/O error occurs, this stream's error state is set to * {@code true}. */ @Override public synchronized void close() { flush(); if (out != null) { try { out.close(); out = null; } catch (IOException e) { setError(); } } }
/** * Closes this print stream. Flushes this stream and then closes the target * stream. If an I/O error occurs, this stream's error state is set to * {@code true}. */ @Override public synchronized void close() { flush(); if (out != null) { try { out.close(); out = null; } catch (IOException e) { setError(); } } }