Пример #1
0
  public byte[] getRawContent() throws UnsupportedEncodingException {
    byte[] idBytes = getBytes(getId(), "ISO-8859-1");
    byte[] contentBytes = getBytes(content, getEncoding());
    byte[] buf = new byte[4 + 4 + idBytes.length + 1 + contentBytes.length];
    byte[] flags = {0x00, 0x00, 0x00, 0x00};

    int offset = 0;
    Utils.copy(getSize(contentBytes.length), buf, offset);
    offset += 4;
    Utils.copy(flags, buf, offset);
    offset += 4;
    Utils.copy(idBytes, buf, offset);
    offset += idBytes.length;
    buf[offset] = 0;
    offset += 1;
    Utils.copy(contentBytes, buf, offset);
    offset += contentBytes.length;

    return buf;
  }