Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class LZWWriterTest {
- @Test
- public void Test() throws IOException {
- char[] cbufOut = { 'T', 'O', 'B', 'E', 'O', 'R', 'N', 'O', 'T', 'T',
- 'O', 'B', 'E', 'O', 'R', 'T', 'O', 'B', 'E', 'O', 'R', 'N',
- 'O', 'T' };
- char[] cbufIn = new char[24];
- byte[] bytes = new byte[1024];
- OutputStream out = new ByteArrayOutputStream();
- InputStream in = new ByteArrayInputStream(bytes);
- LZWWriter lzwwriter = new LZWWriter(out);
- LZWReader lzwreader = new LZWReader(in);
- lzwwriter.write(cbufOut, 0, 24);
- lzwwriter.close();
- lzwreader.read(cbufIn, 0, 24);
- lzwreader.close();
- for (int i = 0; i < 256; i++) {
- System.out.println(lzwwriter.getDictionary().get("" + (char) i));
- }
- assertEquals("Strings didnt match", cbufOut, cbufIn);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement