Class FileSystemAttachmentDataUtil
java.lang.Object
com.atlassian.confluence.pages.persistence.dao.filesystem.FileSystemAttachmentDataUtil
- Since:
- 5.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Used to prefix all temp files created as part of writing an attachment input stream to disk. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
cleanupEmptyAncestors
(File file, File stopAtFile) static void
cleanupEmptyAncestors
(File file, File stopAtFile, boolean suppressLogging) static boolean
static void
writeStreamToFile
(InputStream data, File destFile, Long expectedFileSize) Writes stream to destination file.
-
Field Details
-
TEMP_FILE_PREFIX
Used to prefix all temp files created as part of writing an attachment input stream to disk.- See Also:
-
#writeStreamToFile(java.io.InputStream, java.io.File, long)
- Constant Field Values
-
-
Constructor Details
-
FileSystemAttachmentDataUtil
public FileSystemAttachmentDataUtil()
-
-
Method Details
-
writeStreamToFile
Writes stream to destination file. If the number of bytes in the stream do not match up with the expected size of the attachment an error will be thrown the write will be aborted.- Parameters:
data
- attachment body represented as a streamdestFile
- file to copy stream intoexpectedFileSize
- expected size of the created file. If it is null or zero, the check against the number of bytes in the stream is skipped. The size is only verified against the stream's byte count when it has a non-zero value.- Throws:
AttachmentDataStreamSizeMismatchException
- if the number of bytes in the stream does not match the expectedAttachmentSize
-
isEmpty
- Throws:
IOException
-
cleanupEmptyAncestors
-
cleanupEmptyAncestors
-