Example usage for org.apache.commons.vfs2 RandomAccessContent skipBytes

List of usage examples for org.apache.commons.vfs2 RandomAccessContent skipBytes

Introduction

In this page you can find the example usage for org.apache.commons.vfs2 RandomAccessContent skipBytes.

Prototype

int skipBytes(int n) throws IOException;

Source Link

Document

Makes an attempt to skip over n bytes of data from the input stream, discarding the skipped bytes.

Usage

From source file:org.mycore.datamodel.ifs2.MCRFileTest.java

@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();/*from  ww  w . j  a  v  a  2s. c o m*/
    rac.close();
}