 IN: io.encodings
 
 ! The encoding descriptor protocol
+
+GENERIC: guess-encoded-length ( string-length encoding -- byte-length )
+GENERIC: guess-decoded-length ( byte-length encoding -- string-length )
+
+M: object guess-decoded-length drop ; inline
+M: object guess-encoded-length drop ; inline
 
 GENERIC: decode-char ( stream encoding -- char/f )
 

M: decoder dispose stream>> dispose ;

! Encoding
M: object <encoder> encoder boa ;

: >encoder< ( encoder -- stream encoding )
    [ stream>> ] [ code>> ] bi ; inline

M: encoder stream-element-type
    drop +character+ ;

M: encoder stream-write1
    >encoder< encode-char ;

M: encoder stream-write
    >encoder< encode-string ;

M: encoder dispose stream>> dispose ;

M: encoder stream-flush stream>> stream-flush ;

INSTANCE: encoder plain-writer
PRIVATE>


! Decoding

M: object <decoder> f decoder boa ; inline

<PRIVATE

