JBoss VFS 3.0.1.GA

org.jboss.vfs
Class TempDir

java.lang.Object
  extended by org.jboss.vfs.TempDir
All Implemented Interfaces:
Closeable

public final class TempDir
extends Object
implements Closeable

A temporary directory which exists until it is closed, at which time its contents will be removed.

Author:
David M. Lloyd

Method Summary
 void close()
          Close this directory.
 File createFile(String relativePath, InputStream sourceData)
          Create a file within this temporary directory, prepopulating the file from the given input stream.
protected  void finalize()
           
 File getFile(String relativePath)
          Get the File for a relative path.
 File getRoot()
          Get the File that represents the root of this temporary directory.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRoot

public File getRoot()
             throws IOException
Get the File that represents the root of this temporary directory. The returned file is only valid as long as the tempdir exists.

Returns:
the root file
Throws:
IOException - if the directory was closed at the time of this invocation

getFile

public File getFile(String relativePath)
             throws IOException
Get the File for a relative path. The returned file is only valid as long as the tempdir exists.

Parameters:
relativePath - the relative path
Returns:
the corresponding file
Throws:
IOException - if the directory was closed at the time of this invocation

createFile

public File createFile(String relativePath,
                       InputStream sourceData)
                throws IOException
Create a file within this temporary directory, prepopulating the file from the given input stream.

Parameters:
relativePath - the relative path name
sourceData - the source input stream to use
Returns:
the file
Throws:
IOException - if the directory was closed at the time of this invocation or an error occurs

close

public void close()
           throws IOException
Close this directory. The contents of the directory will be removed.

Specified by:
close in interface Closeable
Throws:
IOException - if an I/O error occurs

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

JBoss VFS 3.0.1.GA

Copyright © 2011 JBoss, A division of Red Hat, Inc. All Rights Reserved.