Class TemporaryFiles
java.lang.Object
net.officefloor.server.http.stream.TemporaryFiles
Provides means to manage temporary
FileChannel content.- Author:
- Daniel Sagenschneider
-
Constructor Summary
ConstructorsConstructorDescriptionTemporaryFiles(String prefix) Instantiate and creates the temporary files area. -
Method Summary
Modifier and TypeMethodDescriptioncreateTempFile(String name, byte[] contents) Creates aFileChannelto a temporary file.createTempFile(String name, byte[] contents, int offset, int length) Creates aFileChannelto a temporary file.createTempFile(String name, InputStream contents) Creates aFileChannelto the temporary file.createTempFile(String name, String contents) Creates aFileChannelto the temporary file using the default HTTP entityCharset.createTempFile(String name, String contents, Charset charset) Creates aFileChannelto the temporary file.static TemporaryFilesObtains the defaultTemporaryFiles.
-
Constructor Details
-
TemporaryFiles
Instantiate and creates the temporary files area.- Parameters:
prefix- Prefix for the temporary files area.- Throws:
IOException- If fails to setup temporary files.
-
-
Method Details
-
getDefault
Obtains the defaultTemporaryFiles.- Returns:
- Default
TemporaryFiles. - Throws:
IOException- If fails to create the defaultTemporaryFiles.
-
createTempFile
Creates aFileChannelto the temporary file.- Parameters:
name- Name to aid identifying the temporary file on disk. May benull.contents-InputStreamto contents for the temporary file.- Returns:
FileChannelto the temporary file.- Throws:
IOException- If fails to create temporary file.
-
createTempFile
public FileChannel createTempFile(String name, byte[] contents, int offset, int length) throws IOException Creates aFileChannelto a temporary file.- Parameters:
name- Name to aid identifying the temporary file on disk. May benull.contents- Contents for the temporary file.offset- Offset into contents.length- Length from offset to write to file.- Returns:
FileChannelto the temporary file.- Throws:
IOException- If fails to create temporary file.
-
createTempFile
Creates aFileChannelto a temporary file.- Parameters:
name- Name to aid identifying the temporary file on disk. May benull.contents- Contents for the temporary file.- Returns:
FileChannelto the temporary file.- Throws:
IOException- If fails to create temporary file.
-
createTempFile
Creates aFileChannelto the temporary file.- Parameters:
name- Name to aid identifying the temporary file on disk. May benull.contents- Contents for the temporary file.charset-Charsetto write the contents. May benullto use default HTTP entityCharset.- Returns:
FileChannelto the temporary file.- Throws:
IOException- If fails to create temporary file.
-
createTempFile
Creates aFileChannelto the temporary file using the default HTTP entityCharset.- Parameters:
name- Name to aid identifying the temporary file on disk. May benull.contents- Contents for the temporary file.- Returns:
FileChannelto the temporary file.- Throws:
IOException- If fails to create temporary file.
-