Serialize all the metadata entries. It produces serialized names and values interleaved. result[i 2] are names, while result[i 2+1] are values. Names are ASCII string bytes that contains only the characters listed in the class comment of Key. If the name ends with "-bin", the
()
| 464 | * <p>This method is intended for transport use only. |
| 465 | */ |
| 466 | @Nullable |
| 467 | byte[][] serialize() { |
| 468 | byte[][] serialized = new byte[len()][]; |
| 469 | if (namesAndValues instanceof byte[][]) { |
| 470 | System.arraycopy(namesAndValues, 0, serialized, 0, len()); |
| 471 | } else { |
| 472 | for (int i = 0; i < size; i++) { |
| 473 | serialized[i * 2] = name(i); |
| 474 | serialized[i * 2 + 1] = valueAsBytes(i); |
| 475 | } |
| 476 | } |
| 477 | return serialized; |
| 478 | } |
| 479 | |
| 480 | /** |
| 481 | * Serializes all metadata entries, leaving some values as {@link InputStream}s. |