USING: accessors ascii byte-arrays byte-vectors combinators
command-line destructors fry io io.encodings io.encodings.binary
-io.files io.streams.string kernel literals locals math
-math.parser namespaces sequences sequences.private strings typed
-;
+io.encodings.string io.encodings.utf8 io.files io.streams.string
+kernel literals locals math math.parser namespaces sequences
+sequences.private strings typed ;
IN: tools.hexdump
M: byte-vector hexdump. all-bytes underlying>> hexdump-bytes ;
+M: string hexdump. utf8 encode hexdump. ;
+
+
: hexdump ( byte-array -- str )
[ hexdump. ] with-string-writer ;
BUILTIN: byte-array
{ length array-capacity read-only initial: 0 } ;
+MIXIN: byte-sequence
+
PRIMITIVE: (byte-array) ( n -- byte-array )
PRIMITIVE: <byte-array> ( n -- byte-array )
PRIMITIVE: resize-byte-array ( n byte-array -- new-byte-array )
resize-byte-array ; inline
INSTANCE: byte-array sequence
+INSTANCE: byte-array byte-sequence
: 1byte-array ( x -- byte-array ) B{ } 1sequence ; inline