ByteArrayReader extends Reader { @Override public int read(char[] cbuf, int off, int len) throws IOException { ensureOpen(); if (position >= limit) { return -1; } int bytesRead = buffer.read(position, cbuf, off, len); position += bytesRead; return bytesRead; } ByteArrayReader(ByteArray buffer); @Override void close(); int getTotalBytesRead(); @Override int read(char[] cbuf, int off, int len); int read(); boolean ready(); long skip(long ns); boolean markSupported(); void mark(int readAheadLimit); void reset();  }
@Test public void testReadCharArrayIntInt() throws IOException { String s = "ABCDEFG1234--ABCDEFG1234--ABCDEFG1234--12345"; ByteArray ba = new ByteArray(s.length()); ba.write(s, 0); read(s, ba); ba = new ByteArray(s.length(), ByteArray.EBCDIC_CHARSET_NAME); ba.write(s, 0); read(s, ba); }