Package com.google.common.io
Class TempFileCreator
java.lang.Object
com.google.common.io.TempFileCreator
- Direct Known Subclasses:
TempFileCreator.JavaIoCreator
,TempFileCreator.JavaNioCreator
,TempFileCreator.ThrowingCreator
Creates temporary files and directories whose permissions are restricted to the current user or,
in the case of Android, the current app. If that is not possible (as is the case under the very
old Android Ice Cream Sandwich release), then this class throws an exception instead of creating
a file or directory that would be more accessible.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
private static final class
private static final class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) abstract File
(package private) abstract File
createTempFile
(String prefix) private static TempFileCreator
(package private) static void
Creates the permissions normally used for Windows filesystems, looking up the user afresh, even if previous calls have initialized thePermissionSupplier
fields.
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
TempFileCreator
private TempFileCreator()
-
-
Method Details
-
createTempDir
- Throws:
IllegalStateException
- if the directory could not be created (to implement the contract ofFiles.createTempDir()
, such as if the system does not support creating temporary directories securely
-
createTempFile
- Throws:
IOException
-
pickSecureCreator
-
testMakingUserPermissionsFromScratch
Creates the permissions normally used for Windows filesystems, looking up the user afresh, even if previous calls have initialized thePermissionSupplier
fields.This lets us test the effects of different values of the
user.name
system property without needing a separate VM or classloader.- Throws:
IOException
-