Re: To read and write bytes via Socket

2013-08-28 Thread Yoshinori Kohyama
Resolved. I overlooked that OutputStream has void write(byte[] b, int off, int len) . With write(byte[] ...) of OutputStream instead of write(char[] ...) of BufferedWritersends I can send the bytes that I want to send. Code: (require '[clojure.java.io :refer :all]) (with-open [s (java.net

Re: To read and write bytes via Socket

2013-08-28 Thread Yoshinori Kohyama
Armando, thank you for your reply. Writing single value with void write(int c) sends same 2 bytes for values larger than 127 as using void write(char[] cbuf, int off, int len) of BufferedReader http://docs.oracle.com/javase/jp/6/api/java/io/BufferedWriter.html Code: (require '[clojure.java

Re: To read and write bytes via Socket

2013-08-28 Thread Armando Blancas
With UTF-8 characters are encoded in a variable number of bytes according to various ranges, as you can see here in section "Description": http://en.wikipedia.org/wiki/UTF-8 Since you're sending your bytes as chars but read back as bytes, your last two bytes create chars that later produce two