Generalized to byteBuffer-backed encodings.