/* (non-Javadoc)
@see java.io.OutputStream#write(byte[])
356863
public void write(byte[] b) throws IOException
	{
		if (b == null)
			throw new NullPointerException();
		p.writeBytes(b, 0, b.length);
	}
410337
public static void writeBuffer(DataOutput out, ByteBuffer buffer) throws IOException {
        if (buffer.hasArray()) {
            out.write(buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining());
            buffer.position(buffer.limit());
        } else {
            final byte[] array = new byte[buffer.remaining()];
            buffer.get(array);
            assert buffer.remaining() == 0 && buffer.position() == buffer.limit();
            out.write(array);
        }
    }
471137
public void writeBytes(byte[] buffer)
        throws IOException
    {
        if (buffer == null)
            os.write('N');
        else
            writeBytes(buffer, 0, buffer.length);
    }
380968
@Override
	public void write(byte[] b, int off, int len) throws PacketException {
		baq.add(b, off, len);
		while (packetSize > 0 || (packetSize = parser.getSize(baq.array(),
				baq.offset(), baq.length())) > 0) {
			if (baq.length() < packetSize) {
				return;
			}
			consumer.accept(baq.array(), baq.offset(), packetSize);
			baq.remove(packetSize);
			packetSize = 0;
		}
	}
740743
public void write(byte[] b, int off, int len) throws IOException
	{
		if (b == null)
			throw new NullPointerException();
		if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length)
			|| ((off + len) < 0))
			throw new IndexOutOfBoundsException();
		p.writeBytes(b, off, len);
	}
918871
@Override
  public void write(byte []buf, int offset, int length, boolean isEnd)
    throws IOException
  {
    if (buf == null)
      throw new NullPointerException();
    else if (offset < 0 || buf.length < offset + length)
      throw new ArrayIndexOutOfBoundsException();

    nativeWrite(_fd, buf, offset, length);
  }
28498
@Override
  public void write(byte[] b, int off, int len) throws IOException {
    for (OutputStream child : children) {
      child.write(b, off, len);
    }
  }
472805
public void write(byte []buf, int offset, int length, boolean isEnd)
    throws IOException
  {
    OutputStream os = _os;
    
    if (os != null) {
      os.write(buf, offset, length);
    }
  }
151834
@Override
    public final void write(byte pBytes[]) throws IOException {
        write(pBytes, 0, pBytes != null ? pBytes.length : 1);
    }
1254637
public void write(byte[] b, int off, int len) throws IOException
    {
        if(_outHelper.isOutputStream_closed()|| _outHelper.isOutputStream_close_initiated_but_not_Flush_ready()){
            Tr.error(tc, "stream.is.closed.no.read.write");                         
            throw new IOException(Tr.formatMessage(tc, "stream.is.closed.no.read.write"));           
        }
        if(b == null){
            Tr.error(tc, "read.write.bytearray.null"); 
            throw new NullPointerException(Tr.formatMessage(tc, "read.write.bytearray.null"));
        }
        if (off <0 || len < 0 || off+len > b.length)
        {            
            Tr.error(tc, "read.write.offset.length.bytearraylength", new Object[] { off,  len, b.length} );
            throw new IndexOutOfBoundsException(Tr.formatMessage(tc, "read.write.offset.length.bytearraylength", new Object[] { off,  len, b.length}));            
        }
        if(this._listener!= null &&  !checkIfCalledFromWLonError()){
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())    
                Tr.debug(tc, "write : non blocking write requested, WriteListener enabled: " + this._listener);
            synchronized(this){                 
              _outHelper.write_NonBlocking(b, off, len);                
            }
        }           
        else {
            _outHelper.writeWork(b, off, len);
            
        }

    }
971311
public void writeBytes(byte[] buffer, int offset, int length)
        throws IOException
    {
        if (buffer == null) {
            os.write('N');
        }
        else {
            os.write('B');
            os.write(length << 8);
            os.write(length);
            os.write(buffer, offset, length);
        }
    }
499021
public void write(byte []buf, int offset, int length, boolean isEnd)
    throws IOException
  {
    System.out.write(buf, offset, length);
    System.out.flush();
  }
994829
@Override
	protected synchronized void write(long offset, byte[] b) throws IOException {
		if (byteBuffer != null) {
			byteBuffer.position((int) offset);
			byteBuffer.put(b);
		} else {
			throw new IOException("Write failed, file " + getPath() + " not mapped for I/O");
		}
	}
391878
@Override
    public void write(byte[] buf, int off, int len)
    {
        write(new String(buf, off, len));
    }
819273
public static void writeBytes(byte[] bytes, OutputStream os) throws IOException {
		
		BufferedOutputStream bos = new BufferedOutputStream(os);
		
		ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
		
		byte[] buf = new byte[1028];
		
		int len;
		while ((len = bis.read(buf, 0, buf.length)) > -1){
			bos.write(buf, 0, len);
		}
		
		bos.flush();
		bos.close();
		
		bis.close();
	}
587131
@Override
    public void write(byte[] b, int offset, int length) throws IOException {
        if (length == 0) {
            return;
        }
        int newcount = count + length;
        if (newcount > buf.length) {
            buf = Arrays.copyOf(buf, oversize(newcount));
        }
        System.arraycopy(b, offset, buf, count, length);
        count = newcount;
    }
964224
@Override
    public void write(@Sensitive byte[] b, int off, int len) throws IOException {
        this.output.write(b, off, len);
    }