Write a byte into outputstream.

The outputstream is not closed after written.

@param b
the byte to be written
@param os
the output stream into which the byte is written
178166
public static void write(byte b, OutputStream os) {
        try {
            os.write(b);
        } catch (IOException e) {
            throw E.ioException(e);
        }
    }
440205
public void write(final int b)
	{
		buffer[pos] = (byte)b;
		size++;
		if(++pos == buffer.length) flushBuffer();
	}
585729
@Override
  public int write(OutputStreamWithBuffer os,
                   char []cBuf, int cOffset, int cLength)
    throws IOException
  {
    byte []bBuf = os.buffer();
    int bOffset = os.offset();
    int bEnd = bBuf.length;

    int cEnd = cOffset + cLength;
    // int cEnd = cOffset + cLength;

    while (cOffset < cEnd) {
      int sublen = Math.min(bEnd - bOffset, cEnd - cOffset);

      for (int i = sublen - 1; i >= 0; i--) {
        char ch = cBuf[cOffset + i];
        
        bBuf[bOffset + i] = (byte) (ch < 0x100 ? ch : 0x3f);
      }

      bOffset += sublen;
      cOffset += sublen;
      
      if (bOffset == bEnd && cLength > 0) {
        bBuf = os.nextBuffer(bOffset);
        bOffset = os.offset();
        bEnd = bBuf.length;
      }
    }

    os.offset(bOffset);
    
    return cLength;
  }
473280
public void writeContent(OutputStream os) throws IOException {
        if (streamBytes != null)
            streamBytes.writeTo(os);
        else if (bytes != null)
            os.write(bytes);
    }
1132974
public void write(byte[]b,int o,int l)
        throws IOException
    {
        _out.write(b,o,l);
    }
844862
public boolean readToOutputStream(OutputStream os)
        throws IOException
    {
        InputStream is = readInputStream();

        if (is == null)
            return false;

        if (_buffer == null)
            _buffer = new byte[256];

        try {
            int len;

            while ((len = is.read(_buffer, 0, _buffer.length)) > 0) {
                os.write(_buffer, 0, len);
            }

            return true;
        } finally {
            is.close();
        }
    }
896136
public static void write(OutputStream os, byte version) throws IOException {
    os.write(FSA_MAGIC >> 24);
    os.write(FSA_MAGIC >> 16);
    os.write(FSA_MAGIC >>  8);
    os.write(FSA_MAGIC);
    os.write(version);
  }
4639
public void writeToStream(OutputStream os) throws IOException
  {
    if (_readLength <= _readOffset) {
      readBuffer();
    }

    while (_readOffset < _readLength) {
      os.write(_readBuffer, _readOffset, _readLength - _readOffset);

      readBuffer();
    }
  }
961730
public void writeObject(Object o) throws IOException {
        ObjectOutputStream oos = AnonymousClassWarnings.checkingObjectOutputStream(out);
        oos.writeObject(o);
        // don't close oss, which will close the underlying stream
        // no need to flush either, given the way oos is implemented
    }
1049667
public static void writeSingleByte(OutputStream out, int b) throws IOException {
        byte[] buffer = new byte[1];
        buffer[0] = (byte) (b & 0xff);
        out.write(buffer);
    }
617665
@Override
  public void write (@Nonnull final byte [] b) throws IOException
  {
    checkThreshold (b.length);
    getStream ().write (b);
    m_nWritten += b.length;
  }
836840
public void write(byte b[], int off, int len) {
    expandIfNecessary(count + len);
    System.arraycopy(b, off, bytes, count, len);
    count += len;
  }
1011259
public static void writeBytes(OutputStream os, byte[] buf) throws IOException {
        if (buf.length < OP_PUSHDATA1) {
            os.write(buf.length);
            os.write(buf);
        } else if (buf.length < 256) {
            os.write(OP_PUSHDATA1);
            os.write(buf.length);
            os.write(buf);
        } else if (buf.length < 65536) {
            os.write(OP_PUSHDATA2);
            Utils.uint16ToByteStreamLE(buf.length, os);
            os.write(buf);
        } else {
            throw new RuntimeException("Unimplemented");
        }
    }
1363364
@Override
  public void write(int b) throws IOException
  {
    if(!bytesBuffer.hasRemaining()) {
      processBytesBuffer(false);
    }
    bytesBuffer.put((byte)b);
  }
1290832
public static void writeHexBytes(byte[] o, int from, byte[] b) {

        int len = b.length;

        for (int i = 0; i < len; i++) {
            int c = ((int) b[i]) & 0xff;

            o[from++] = HEXBYTES[c >> 4 & 0xf];
            o[from++] = HEXBYTES[c & 0xf];
        }
    }
676682
@Override
    public void write(byte[] b) throws IOException {
        if (b.length == 0)
            return;
        fos().write(b);
        currFileBytesWritten += b.length;
        totalBytesWritten += b.length;
    }
269933
public void writeToStream(OutputStreamWithBuffer os)
    throws IOException
  {
    StreamImpl is = openReadImpl();

    try {
      byte []buffer = os.buffer();
      int offset = os.offset();
      int length = buffer.length;

      while (! os.isClosed()) {
        int sublen = length - offset;

        if (sublen <= 0) {
          buffer = os.nextBuffer(offset);
          offset = os.offset();
          sublen = length - offset;
        }

        sublen = is.read(buffer, offset, sublen);

        if (sublen <= 0) {
          os.offset(offset);
          return;
        }

        offset += sublen;
      }
    } finally {
      is.close();
    }
  }