Enables colored output
@return true if the colored output was already enabled before
@throws IOException if writing to the underlying output stream failed
333190
private boolean enableRed() throws IOException {
		boolean oldwriting = writing;
		if (!writing) {
			writing = true;
			byte[] en = "\u001B[31m".getBytes();
			super.write(en, 0, en.length);
		}
		return oldwriting;
	}
138426
public void writeDefinition(final OutputStream result) throws IOException
    {
        result.write(COLOR_RED);
        result.write(intToByteArray(red));
        result.write(COLOR_GREEN);
        result.write(intToByteArray(green));
        result.write(COLOR_BLUE);
        result.write(intToByteArray(blue));
        result.write(COLON);    	
    }
1029402
public void setOutput(OutputStream os, String encoding) throws IOException {
		if (os == null)
			throw new IllegalArgumentException("output stream can not be null");
		reset();
		if (encoding != null) {
			out = new OutputStreamWriter(os, encoding);
		} else {
			out = new OutputStreamWriter(os);
		}
	}
309567
public function getOutputDecorated()
    {
        if ($this->colorMode() === self::COLOR_MODE_AUTO) {
            return;
        } elseif ($this->colorMode() === self::COLOR_MODE_FORCED) {
            return true;
        } elseif ($this->colorMode() === self::COLOR_MODE_DISABLED) {
            return false;
        }
    }
397058
private boolean canWrite(File outputFile) {
		boolean fileIsValid = false;
		if (outputFile.exists()) {
			int result = JOptionPane.showConfirmDialog(
					this, "File exists, overwrite?",
					"Warning", JOptionPane.YES_NO_CANCEL_OPTION);
			switch (result) {
			case JOptionPane.YES_OPTION:
				fileIsValid = true;
				break;
			default:
				fileIsValid = false;
			}
		} else {
			fileIsValid = true;
		}
		return fileIsValid;
	}
1025110
static public function shouldColorize($colored = null) {
		return self::$_enabled === true ||
			(self::$_enabled !== false &&
				($colored === true ||
					($colored !== false && Streams::isTty())));
	}
432506
@Override
  public void closeWrite() throws IOException
  {
    if (_isCloseWrite) {
      return;
    }
    
    _isCloseWrite = true;
    
    OutputStream os = _os;
    _os = null;
    
    boolean isShutdownOutput = false;

    // since the output stream is opened lazily, we might
    // need to open it
    if (_s instanceof SSLSocket) {
      // ssl socket cannot be half-closed
      log.finer(L.l("sslSocket can not be half-closed"));
      return;
    }
    else if (_s != null) {
      try {
        _s.shutdownOutput();
        
        isShutdownOutput = true;
      } catch (UnsupportedOperationException e) {
        log.log(Level.FINEST, e.toString(), e);
      } catch (Exception e) {
        log.finer(e.toString());
        log.log(Level.FINEST, e.toString(), e);
      }
    }

    // SSLSocket doesn't support shutdownOutput()
    if (! isShutdownOutput && os != null) {
      os.close();
    }
  }
89188
public void write(OutputStream out)
         throws IOException
    {
        Writer writer = new OutputStreamWriter(out);
        write(writer);
        writer.flush();
    }
821858
protected OutputStream getOutputStream()
        throws IOException
    {
        if (os == null && server != null)
            os = server.writeChannel(channel);

        return os;
    }
111729
public void printString(Color color, final PrintWriter writer) {
        color._switch(new ColorSwitchBlock() {            
            @Override
            public void _case(Red x) {
                writer.print("red");
            }
            
            @Override
            public void _case(Green x) {
                writer.print("green");                
            }
            
            @Override
            public void _case(Blue x) {
                writer.print("blue");
            }           
        });
    }
197936
protected boolean checkBuffer() throws IOException {
        if (!enableMultiReadofPostData) {
            if (null != this.buffer) {
                if (this.buffer.hasRemaining()) {
                    return true;
                }
                this.buffer.release();
                this.buffer = null;
            }
            try {
                this.buffer = this.isc.getRequestBodyBuffer();
                if (null != this.buffer) {
                    // record the new amount of data read from the channel
                    this.bytesRead += this.buffer.remaining();
                    // Tr.debug(tc, "Buffer=" + WsByteBufferUtils.asString(this.buffer));
                    return true;
                }
                return false;
            } catch (IOException e) {
                this.error = e;
                throw e;
            }
        } else {
            return checkMultiReadBuffer();
        }
    }
1276232
public boolean isEveryOwnedOutputSpent(TransactionBag transactionBag) {
        for (TransactionOutput output : outputs) {
            if (output.isAvailableForSpending() && output.isMineOrWatched(transactionBag))
                return false;
        }
        return true;
    }
894325
def isEnabled(self):
        
        if self._disableWithLayer and self._layer:
            lenabled = self._layer.isEnabled()
        elif self._inputNode and self._outputNode:
            lenabled = self._inputNode.isEnabled() and self._outputNode.isEnabled()
        else:
            lenabled = True

        return self._enabled and lenabled
626489
private boolean refill() throws IOException {
    if (!byteBuffer.hasRemaining()) {
      byteBuffer.clear();
      int nRead = 0;
      while (nRead == 0) {
        nRead = fileChannel.read(byteBuffer);
      }
      if (nRead < 0) {
        return false;
      }
      byteBuffer.flip();
    }
    return true;
  }
404398
def decolorized_write(self, fileobj: IO, msg: str) -> None:
        
        if self.colors.lower() == constants.COLORS_NEVER.lower() or \
                (self.colors.lower() == constants.COLORS_TERMINAL.lower() and not fileobj.isatty()):
            msg = utils.strip_ansi(msg)
        fileobj.write(msg)
10489
@Override
	public void write(final OutputStream output) throws IOException
	{
		initialize();
		if (content == null)
		{
			content = new byte[0];
		}
		output.write(content, 0, content.length);
		output.flush();
	}
1070384
public Word07Writer flush(OutputStream out, boolean isCloseOut) throws IORuntimeException {
		Assert.isFalse(this.isClosed, "WordWriter has been closed!");
		try {
			this.doc.write(out);
			out.flush();
		} catch (IOException e) {
			throw new IORuntimeException(e);
		} finally {
			if (isCloseOut) {
				IoUtil.close(out);
			}
		}
		return this;
	}