User e469f67125
23-04-2008 18:59:16
The attached test program writes a smiles using MolExporter in two ways, to a file (works fine), and to a java.io.ObjectOutputStream(java.io.ByteArrayOutputStream). The ByteArrayOutputStream is written to stdout using ByteArrayOutputStream.writeTo(System.out). The problem is that stdout is different than the output file. There seems to be some binary data pre-pended to the smiles.
I know this is a trivial example and this program could be fixed in many ways. But the real problem comes when I try a binary output format such as PNG and a ByteArray is necessary.
Thanks in advance for any help, and sorry if I'm missing something obvious.
$ java test_stdout > zz.smi
$ ls -l z.smi zz.smi
-rw-r--r-- 1 jjyang jjyang 18 Apr 23 12:55 z.smi
-rw-r--r-- 1 jjyang jjyang 24 Apr 23 12:55 zz.smi
$ cat z.smi
NCCc1ccc(O)c(O)c1
$ cat zz.smi
��wNCCc1ccc(O)c(O)c1
JChem version: 5_0_02_1
JDK: 1.6.0_03, linux 32bit
I know this is a trivial example and this program could be fixed in many ways. But the real problem comes when I try a binary output format such as PNG and a ByteArray is necessary.
Thanks in advance for any help, and sorry if I'm missing something obvious.
$ java test_stdout > zz.smi
$ ls -l z.smi zz.smi
-rw-r--r-- 1 jjyang jjyang 18 Apr 23 12:55 z.smi
-rw-r--r-- 1 jjyang jjyang 24 Apr 23 12:55 zz.smi
$ cat z.smi
NCCc1ccc(O)c(O)c1
$ cat zz.smi
��wNCCc1ccc(O)c(O)c1
JChem version: 5_0_02_1
JDK: 1.6.0_03, linux 32bit