public void close() throws FileSystemException { if ( content != null ) { content.close(); content = null; } }
@Override public void close() throws FileSystemException { fileContent.close(); }
@Override public INSTANCE read(FileObject source) throws IOException { FileContent content = null; try { content = source.getContent(); return streamReader.read(content.getInputStream()); } finally { if (content != null) content.close(); } }
/** * Closes this file, and its content. * * @throws FileSystemException if an error occurs. */ @Override public void close() throws FileSystemException { FileSystemException exc = null; // Close the content if (content != null) { try { content.close(); content = null; } catch (final FileSystemException e) { exc = e; } } // Detach from the file try { detach(); } catch (final Exception e) { exc = new FileSystemException("vfs.provider/close.error", fileName, e); } if (exc != null) { throw exc; } }
/** * Closes this file, and its content. * * @throws FileSystemException if an error occurs. */ @Override public void close() throws FileSystemException { FileSystemException exc = null; synchronized (fileSystem) { // Close the content if (content != null) { try { content.close(); content = null; } catch (final FileSystemException e) { exc = e; } } // Detach from the file try { detach(); } catch (final Exception e) { exc = new FileSystemException("vfs.provider/close.error", fileName, e); } if (exc != null) { throw exc; } } }
/** * Closes this file, and its content. * * @throws FileSystemException if an error occurs. */ @Override public void close() throws FileSystemException { FileSystemException exc = null; // Close the content if (content != null) { try { content.close(); content = null; } catch (final FileSystemException e) { exc = e; } } // Detach from the file try { detach(); } catch (final Exception e) { exc = new FileSystemException("vfs.provider/close.error", fileName, e); } if (exc != null) { throw exc; } }
content.close(); content = null;
@Test public void testClose() throws Exception { decorated.close(); verify( fileContent ).close(); }
private void updateScript( FileObject file ) { FileName name = file.getName(); getLogger().info( "New script file found: " + name ); String script; try { FileContent content = file.getContent(); script = IOUtil.toString( content.getInputStream() ); content.close(); } catch ( IOException e ) { getLogger().warn( "Unable to read script file: " + name, e ); return; } synchronized ( scripts ) { scripts.put( getName( name ), script ); } }
private void resolveAndOpenCloseContent() throws FileSystemException { try (final FileObject zipFileObject = manager.resolveFile(zipFileUri)) { zipFileObject.getContent().close(); } }
private void resolveAndOpenCloseContent() throws FileSystemException { try (final FileObject zipFileObject = manager.resolveFile(zipFileUri)) { zipFileObject.getContent().close(); } }
someFileContent.getInputStream(); assertThat( solutionRepositoryVfsFileObject.isContentOpen(), is( true ) ); someFileContent.close(); assertThat( solutionRepositoryVfsFileObject.isContentOpen(), is( false ) );
/** * Tests that content and file objects are usable after being closed. */ public void testReuse() throws Exception { // Get the test file final FileObject file = getReadFolder().resolveFile("file1.txt"); assertEquals(FileType.FILE, file.getType()); assertTrue(file.isFile()); // Get the file content assertSameContent(FILE1_CONTENT, file); // Read the content again assertSameContent(FILE1_CONTENT, file); // Close the content + file file.getContent().close(); file.close(); // Read the content again assertSameContent(FILE1_CONTENT, file); }
/** * Tests that content and file objects are usable after being closed. */ public void testReuse() throws Exception { // Get the test file final FileObject file = getReadFolder().resolveFile("file1.txt"); assertEquals(FileType.FILE, file.getType()); assertTrue(file.isFile()); // Get the file content assertSameContent(FILE1_CONTENT, file); // Read the content again assertSameContent(FILE1_CONTENT, file); // Close the content + file file.getContent().close(); file.close(); // Read the content again assertSameContent(FILE1_CONTENT, file); }
/** * Tests that content and file objects are usable after being closed. */ public void testReuse() throws Exception { // Get the test file final FileObject file = getReadFolder().resolveFile("file1.txt"); assertEquals(FileType.FILE, file.getType()); assertTrue(file.isFile()); // Get the file content assertSameContent(FILE1_CONTENT, file); // Read the content again assertSameContent(FILE1_CONTENT, file); // Close the content + file file.getContent().close(); file.close(); // Read the content again assertSameContent(FILE1_CONTENT, file); }