Class TemporaryFiles
- java.lang.Object
-
- net.officefloor.server.http.stream.TemporaryFiles
-
public class TemporaryFiles extends java.lang.ObjectProvides means to manage temporaryFileChannelcontent.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description TemporaryFiles(java.lang.String prefix)Instantiate and creates the temporary files area.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.channels.FileChannelcreateTempFile(java.lang.String name, byte[] contents)Creates aFileChannelto a temporary file.java.nio.channels.FileChannelcreateTempFile(java.lang.String name, byte[] contents, int offset, int length)Creates aFileChannelto a temporary file.java.nio.channels.FileChannelcreateTempFile(java.lang.String name, java.io.InputStream contents)Creates aFileChannelto the temporary file.java.nio.channels.FileChannelcreateTempFile(java.lang.String name, java.lang.String contents)Creates aFileChannelto the temporary file using the default HTTP entityCharset.java.nio.channels.FileChannelcreateTempFile(java.lang.String name, java.lang.String contents, java.nio.charset.Charset charset)Creates aFileChannelto the temporary file.static TemporaryFilesgetDefault()Obtains the defaultTemporaryFiles.
-
-
-
Method Detail
-
getDefault
public static TemporaryFiles getDefault() throws java.io.IOException
Obtains the defaultTemporaryFiles.- Returns:
- Default
TemporaryFiles. - Throws:
java.io.IOException- If fails to create the defaultTemporaryFiles.
-
createTempFile
public java.nio.channels.FileChannel createTempFile(java.lang.String name, java.io.InputStream contents) throws java.io.IOExceptionCreates 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:
java.io.IOException- If fails to create temporary file.
-
createTempFile
public java.nio.channels.FileChannel createTempFile(java.lang.String name, byte[] contents, int offset, int length) throws java.io.IOExceptionCreates 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:
java.io.IOException- If fails to create temporary file.
-
createTempFile
public java.nio.channels.FileChannel createTempFile(java.lang.String name, byte[] contents) throws java.io.IOExceptionCreates 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:
java.io.IOException- If fails to create temporary file.
-
createTempFile
public java.nio.channels.FileChannel createTempFile(java.lang.String name, java.lang.String contents, java.nio.charset.Charset charset) throws java.io.IOExceptionCreates 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:
java.io.IOException- If fails to create temporary file.
-
createTempFile
public java.nio.channels.FileChannel createTempFile(java.lang.String name, java.lang.String contents) throws java.io.IOExceptionCreates 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:
java.io.IOException- If fails to create temporary file.
-
-