Example usage for org.apache.commons.vfs FileContent getRandomAccessContent

List of usage examples for org.apache.commons.vfs FileContent getRandomAccessContent

Introduction

In this page you can find the example usage for org.apache.commons.vfs FileContent getRandomAccessContent.

Prototype

public RandomAccessContent getRandomAccessContent(final RandomAccessMode mode) throws FileSystemException;

Source Link

Document

Returns an stream for reading/writing the file's content.

Usage

From source file:unitTests.dataspaces.AbstractLimitingFileObjectTest.java

@Test
public void testReadOnlyGetContentRandomInputStream() throws IOException {
    createRealFile();//www . j  av  a 2  s . c o  m

    final FileContent content = readOnlyFile.getContent();
    try {
        content.getRandomAccessContent(RandomAccessMode.READ).close();
    } finally {
        content.close();
    }
}

From source file:unitTests.dataspaces.AbstractLimitingFileObjectTest.java

@Test
public void testReadOnlyGetContentRandomOutputStream() throws IOException {
    createRealFile();/*  ww w.  j a  v  a  2  s. co  m*/

    final FileContent content = readOnlyFile.getContent();
    try {
        content.getRandomAccessContent(RandomAccessMode.READWRITE).close();
        fail("Expected exception");
    } catch (FileSystemException x) {
    } finally {
        content.close();
    }
}

From source file:unitTests.dataspaces.AbstractLimitingFileObjectTest.java

@Test
public void testReadWriteGetContentRandomInputStream() throws IOException {
    createRealFile();//w  w w  .ja  va 2  s.  co m

    final FileContent content = readWriteFile.getContent();
    try {
        content.getRandomAccessContent(RandomAccessMode.READ).close();
    } finally {
        content.close();
    }
}

From source file:unitTests.dataspaces.AbstractLimitingFileObjectTest.java

@Test
public void testReadWriteGetContentRandomOutputStream() throws IOException {
    createRealFile();// w ww.  jav a 2 s  .c o  m

    final FileContent content = readWriteFile.getContent();
    try {
        content.getRandomAccessContent(RandomAccessMode.READWRITE).close();
    } finally {
        content.close();
    }
}