public void add(int b)
   {
      if (bufferSize == buffer.length)
      {
         byte[] newBuffer = new byte[buffer.length + (buffer.length >> 1)];
         System.arraycopy(buffer, 0, newBuffer, 0, bufferSize);
         buffer = newBuffer;
      }

      buffer[bufferSize++] = (byte) b;
   }