java.io.PrintStream.setError()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中java.io.PrintStream.setError()方法的一些代码示例,展示了PrintStream.setError()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PrintStream.setError()方法的具体详情如下:
包路径:java.io.PrintStream
类名称:PrintStream
方法名:setError

PrintStream.setError介绍

[英]Sets the error flag of this print stream to true.
[中]将此打印流的错误标志设置为true。

代码示例

代码示例来源:origin: robovm/robovm

/**
 * 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();
}

代码示例来源:origin: robovm/robovm

/**
 * 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();
    }
  }
}

代码示例来源:origin: robovm/robovm

/**
 * 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();
  }
}

代码示例来源:origin: robovm/robovm

setError();
return;
setError();

代码示例来源:origin: robovm/robovm

synchronized (this) {
  if (out == null) {
    setError();
    return;
    setError();

代码示例来源:origin: org.maltparser/maltparser

@Override
protected void setError() {
  super.setError();
}

代码示例来源:origin: org.clulab/processors

@Override
protected void setError() {
  super.setError();
}

代码示例来源:origin: dragome/dragome-sdk

public void flush()
{
  try
  {
    out.flush();
  }
  catch (IOException e)
  {
    setError();
  }
}

代码示例来源:origin: dragome/dragome-sdk

public void write(byte[] buf, int off, int len)
{
  try
  {
    out.write(buf, off, len);
  }
  catch (IOException e)
  {
    setError();
  }
}

代码示例来源:origin: dragome/dragome-sdk

public void write(String str)
{
  try
  {
    out.write(str);
  }
  catch (IOException e)
  {
    setError();
  }
}

代码示例来源:origin: dragome/dragome-sdk

public void print(String s)
{
  try
  {
    out.write(s);
  }
  catch (IOException e)
  {
    setError();
  }
}

代码示例来源:origin: dragome/dragome-sdk

public void write(int b)
{
  try
  {
    out.write(b);
  }
  catch (IOException e)
  {
    setError();
  }
}

代码示例来源:origin: MobiVM/robovm

/**
 * 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();
}

代码示例来源:origin: ibinti/bugvm

/**
 * 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();
}

代码示例来源:origin: com.jtransc/jtransc-rt

/**
 * 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();
}

代码示例来源:origin: MobiVM/robovm

/**
 * 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();
    }
  }
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * 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();
    }
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * 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();
    }
  }
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * 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();
    }
  }
}

代码示例来源:origin: ibinti/bugvm

/**
 * 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();
    }
  }
}

相关文章