public static int getNextNullTerminator(byte[] buffer, int startingFrom, Charset charset)
   {
      int index=0;
      if (charset.equals(CHARSET_ISO_8859_1))
      {
         for(index=startingFrom; index<buffer.length && buffer[index] != 0; ++index);
      }
      else if (charset.equals(CHARSET_UTF_16))
      {
         for(index=startingFrom; index+1<buffer.length && !(buffer[index] == 0 && buffer[index+1] == 0); index += 2);
      }
      return index;
   }