encode

abstract fun encode(name: String): ByteBuffer

Encode a file name or a comment to a byte array suitable for storing it to a serialized zip entry.

Examples for CP 437 (in pseudo-notation, right hand side is C-style notation):

 encode("\u20AC_for_Dollar.txt") = "%U20AC_for_Dollar.txt"
 encode("\u00D6lf\u00E4sser.txt") = "\231lf\204sser.txt"

Return

A byte buffer with a backing array containing the encoded name. Unmappable characters or malformed character sequences are mapped to a sequence of utf-16 words encoded in the format %Uxxxx. It is assumed, that the byte buffer is positioned at the beginning of the encoded result, the byte buffer has a backing array and the limit of the byte buffer points to the end of the encoded result.

Parameters

name

A file name or ZIP comment.

Throws

on error