| Allegro CL version 6.2 This page is new in 6.2 | |||||||||
Arguments: usb8-array &optional (wrap-at-column 52)
Takes the (unsigned-byte 8) array specified by the
usb8-array, assumes it is a base64 encoding (with the first (index 0) element the most significant), and
converts it to a base64 string. If wrap-at-column is
non-nil, its value must be a positive integer
and newlines are inserted in the string each time that number of
characters is output. If wrap-at-column is
nil, no newlines are inserted.
The function base64-string-to-usb8-array converts a base64 string (the output of this function) back to an (unsigned-byte 8) array.
Here are some examples. First we show that the first array element is the most significant (using base64-string-to-integer). Then we give a more complex example.
cl-user(2): (setq ar1 (make-array 2 :element-type '(unsigned-byte 8)
:initial-contents '(10 40)))
#(10 40)
cl-user(3): (setq b1 (usb8-array-to-base64-string ar1))
"Cig="
cl-user(4): (base64-string-to-integer b1)
2600 ;; equals (+ (* 10 (expt 2 8)) 40) equals (+ 2560 40)
cl-user(5): (setq a (string-to-octets
(setq s
"
(defun deep-thought ()
(sleep (years2secs 7500000))
42)
")))
#(10 40 100 101 102 117 110 32 100 101 ...)
cl-user(6): (usb8-array-to-base64-string a)
"CihkZWZ1biBkZWVwLXRob3VnaHQgKCkKICAoc2xlZXAgKHllYXJz
MnNlY3MgNzUwMDAwMCkpCiAgNDIpCgA="
cl-user(7): (base64-string-to-usb8-array *)
#(10 40 100 101 102 117 110 32 100 101 ...)
cl-user(8): (setq a2 *)
#(10 40 100 101 102 117 110 32 100 101 ...)
cl-user(9): (equalp a a2)
t
cl-user(10): (octets-to-string a2)
"
(defun deep-thought ()
(sleep (years2secs 7500000))
42)
"
61
61
See Base64 Support in miscellaneous.htm for information on Base64 and Base64 support in Allegro CL.
Copyright (c) 1998-2002, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 6.2. This page is new in the 6.2 release.
Created 2002.2.26.
| Allegro CL version 6.2 This page is new in 6.2 | |||||||||