use of org.apache.commons.vfs2.RandomAccessContent in project mycore by MyCoRe-Org.
the class MCRFileTest method randomAccessContent.
@Test
public void randomAccessContent() throws Exception {
MCRFile file = col.createFile("foo.txt");
byte[] content = "Hello World".getBytes("UTF-8");
file.setContent(new MCRByteContent(content, System.currentTimeMillis()));
RandomAccessContent rac = file.getRandomAccessContent();
rac.skipBytes(6);
InputStream in = rac.getInputStream();
char c = (char) in.read();
assertEquals('W', c);
in.close();
rac.close();
}
Aggregations