Writes a byte array prefixed by its length encoded using vByte.

@param a the array to be written.
@param s the stream where the array should be written.
513847
public final static void writeByteArray(final byte[] a, final ObjectOutputStream s) throws IOException {
		writeVByte(a.length, s);
		s.write(a);
	}
897772
private static void writeLEShort(OutputStream out, short s) throws IOException {
		out.write((byte)s);
		out.write((byte)((s >> 8) & 0xFF));
	}
566199
public void write(byte[] byteArray, int byteCount) throws IOException {

        writeStream.write(byteArray, 0, byteCount);

        bytesWritten += byteCount;
    }
766933
public void writeRawBytes(final byte[] value, int offset, int length)
                            throws IOException {
    if (limit - position >= length) {
      // We have room in the current buffer.
      System.arraycopy(value, offset, buffer, position, length);
      position += length;
    } else {
      // Write extends past current buffer.  Fill the rest of this buffer and
      // flush.
      final int bytesWritten = limit - position;
      System.arraycopy(value, offset, buffer, position, bytesWritten);
      offset += bytesWritten;
      length -= bytesWritten;
      position = limit;
      refreshBuffer();

      // Now deal with the rest.
      // Since we have an output stream, this is our buffer
      // and buffer offset == 0
      if (length <= limit) {
        // Fits in new buffer.
        System.arraycopy(value, offset, buffer, 0, length);
        position = length;
      } else {
        // Write is very big.  Let's do it all at once.
        output.write(value, offset, length);
      }
    }
  }
568147
public void write(String s)
        throws IOException
    {
        int length=s.length();
        ensureSpareCapacity(length);
        for (int i=0;i<length;i++)
        {
            char c=s.charAt(i);
            if (c>=0x0&&c<=0x7f)
                _buf[_size++]=(byte)c;
            else
            {
                writeEncoded(s.toCharArray(),i,length-i);
                break;
            }
        }

        
    }
947862
public void append(final byte[][] a)
	{
		if(a == null) throw new NullPointerException();

		for(int k = 0; k < a.length; k++) {
			append(a[k]);
		}
	}
366043
public static byte[] serialize(Serializable s) throws IOException {

        HsqlByteArrayOutputStream bo = new HsqlByteArrayOutputStream();
        ObjectOutputStream        os = new ObjectOutputStream(bo);

        os.writeObject(s);

        return bo.toByteArray();
    }
124300
public void writeStringLength(byte[] bytes) {
    int length = bytes.length;
    while (remaining() < length + 9) {
      grow();
    }
    writeLength(length);
    System.arraycopy(bytes, 0, buf, position, length);
    position += length;
  }
393667
public static void writeBytes(byte b[], int offset, byte[] value) {
    System.arraycopy(value, 0, b, offset, value.length);
  }
197822
private void writeObject(java.io.ObjectOutputStream s)
                    throws java.io.IOException {

        s.defaultWriteObject();

        Object[] elements = getArray();
        // Write out array length
        s.writeInt(elements.length);

        // Write out all elements in the proper order.
        for (Object element : elements)
            s.writeObject(element);
    }
1370574
public void write(String s, int off, int len) throws IOException {
	    if (writer != null) {
	        writer.write(s, off, len);
	    } else {
	        ensureOpen();
	        //PK33136
	        strBuffer.append(s.substring(off, off+len));
	        nextChar += len;
	        //PK33136
	    }
    }
909784
public static void writeString(ByteBuffer buffer, String s) throws IOException {
    if(s == null) {
      s = ""; // Which will be written as Varint 0 = single byte 0.
    }
    ByteArrayUtil.STRING_SERIALIZER.toByteBuffer(buffer, s);
  }
854993
@Override
  public void write(byte []buf, int offset, int length, boolean isEnd)
    throws IOException
  {
    while (offset < length) {
      TempBuffer tail = _tail;
      
      if (tail == null || tail.buffer().length <= tail.length()) {
        addBuffer(TempBuffer.create());
        tail = _tail;
      }
      
      int tailLength = tail.length();
      
      
      byte []tailBuffer = tail.buffer();

      int sublen = tailBuffer.length - tailLength;
      if (length - offset < sublen) {
        sublen = length - offset;
      }

      System.arraycopy(buf, offset, tailBuffer, tailLength, sublen);

      offset += sublen;
      tail.length(tailLength + sublen);
    }
  }
471137
public void writeBytes(byte[] buffer)
        throws IOException
    {
        if (buffer == null)
            os.write('N');
        else
            writeBytes(buffer, 0, buffer.length);
    }
476401
public void write(final byte[] srcBytes, final int srcOffset, final int length)
    {
        final long resultingOffset = position + ((long)length);
        if (resultingOffset > this.length)
        {
            throw new IllegalStateException("insufficient capacity in the buffer");
        }

        buffer.putBytes(offset + position, srcBytes, srcOffset, length);
        position += length;
    }
444730
@Override
	public void writeShort(short v) throws IOException {
		outputStream.write(0xFF & v);
		outputStream.write(0xFF & (v >> 8));
		bytesWritten += 2;
	}
828576
public void
writeCountedString(byte [] s) {
	if (s.length > 0xFF) {
		throw new IllegalArgumentException("Invalid counted string");
	}
	need(1 + s.length);
	array[pos++] = (byte)(s.length & 0xFF);
	writeByteArray(s, 0, s.length);
}