2424import static org .junit .Assert .assertTrue ;
2525import static org .junit .Assert .fail ;
2626
27+ import java .io .BufferedInputStream ;
2728import java .io .BufferedReader ;
2829import java .io .ByteArrayInputStream ;
30+ import java .io .ByteArrayOutputStream ;
2931import java .io .IOException ;
3032import java .io .InputStream ;
3133import java .io .InputStreamReader ;
3234import java .util .Arrays ;
3335
36+ import org .junit .Ignore ;
3437import org .junit .Test ;
3538
3639/**
@@ -50,6 +53,34 @@ public class Base64InputStreamTest {
5053
5154 private static final String STRING_FIXTURE = "Hello World" ;
5255
56+ /**
57+ * Tests the problem reported in CODEC-130. Missing / wrong implementation of skip.
58+ */
59+ @ Test
60+ @ Ignore
61+ public void testCodec130 () throws IOException {
62+ ByteArrayOutputStream bos = new ByteArrayOutputStream ();
63+ Base64OutputStream base64os = new Base64OutputStream (bos );
64+
65+ base64os .write ("Hello World!" .getBytes ());
66+
67+ ByteArrayInputStream bis = new ByteArrayInputStream (bos .toByteArray ());
68+ Base64InputStream ins = new Base64InputStream (bis );
69+
70+ // we skip the first character read from the reader
71+ ins .skip (1 );
72+ StringBuffer sb = new StringBuffer ();
73+ int len = 0 ;
74+ byte [] bytes = new byte [10 ];
75+ while ((len = ins .read (bytes )) != -1 ) {
76+ String s = new String (bytes , 0 , len , "iso-8859-1" );
77+ sb .append (s );
78+ }
79+ String str = sb .toString ();
80+
81+ assertEquals ("ello World!" , str );
82+ }
83+
5384 /**
5485 * Tests the bug reported in CODEC-105. Bad interactions with InputStream when reading one byte at a time.
5586 */
0 commit comments