CharStream and ByteStream?
zhong.j.yu at gmail.com
Fri Mar 8 08:24:41 PST 2013
Many applications process streams of chars/bytes. Using IntStream to
represent char/byte stream is a little inconvenient. Should we add
CharStream and ByteStream as well?
Particularly, conversion between int and byte is quite confusing,
there are two ways to encode a byte in the 0x80-0xFF range in an int.
Producers have to always specify which encoding they use, for example
see InputStream.read(). Consumers can handle both encodings but it
requires attention. The problem is more subtle in lambda expressions,
since parameter types aren't declared, programmers can easily forget
that they are dealing with ints instead of bytes.
More information about the lambda-dev