core/src/test/java/org/apache/commons/vfs2/test/ContentTests.java
/**
     * Tests that input streams are cleaned up on file close.
     */
Tests that input streams are cleaned up on file close.
Tests that input streams are cleaned up on file close .
public void testInstrCleanup() throws Exception
    {
        FileObject file = getReadFolder().resolveFile("file1.txt");
        assertEquals(FileType.FILE, file.getType());
        final InputStream instr1 = file.getContent().getInputStream();
        assertTrue(instr1.read() == FILE1_CONTENT.charAt(0));
        final InputStream instr2 = file.getContent().getInputStream();
        assertTrue(instr2.read() == FILE1_CONTENT.charAt(0));
        file.close();
        assertTrue(instr1.read() == -1);
        assertTrue(instr2.read() == -1);
    }
public void testInstrCleanup ( ) throws Exception { FileObject file = getReadFolder ( ) . resolveFile ( "file1.txt" ) ; assertEquals ( FileType . FILE , file . getType ( ) ) ; final InputStream instr1 = file . getContent ( ) . getInputStream ( ) ; assertTrue ( instr1 . read ( ) == FILE1_CONTENT . charAt ( 0 ) ) ; final InputStream instr2 = file . getContent ( ) . getInputStream ( ) ; assertTrue ( instr2 . read ( ) == FILE1_CONTENT . charAt ( 0 ) ) ; file . close ( ) ; assertTrue ( instr1 . read ( ) == - 1 ) ; assertTrue ( instr2 . read ( ) == - 1 ) ; }
Tests that input streams are cleaned up on file close.
Tests that input streams are cleaned up on file close .
// Get the test file // Open some input streams // Close the file // Check