[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: binary vs non-binary ports
Alex Shinn wrote:
> One interesting thing
> I discovered was that java.io.RandomAccessFile allows you to intermix
> reading characters and binary data on the same stream.
RandomAccessFile has limited accessability. You could use it for
output-only ports, the standard input ports, network ports, or most
other ports you might want.
A possible way to get more portability is to go ahead and provide the
API for specifying port types, such as
(open-input-file path [encoding])
(open-input-file path "utf")
(open-input-file path "latin-1")
#t means "default encoding" (as specified by environment).
Thus (open-input-file path) == (open-input-file #t)
#f means "binary"
Kawa instead uses "fluid" variables, but I could easily
handle an extension like the above.
(I'm travelling so I'll have to answer more fully later.)