com.atlassian.confluence.pages.persistence.dao.filesystem
Class FileSystemAttachmentDataUtil

java.lang.Object
  extended by com.atlassian.confluence.pages.persistence.dao.filesystem.FileSystemAttachmentDataUtil

public class FileSystemAttachmentDataUtil
extends java.lang.Object

Since:
v5.5

Field Summary
static java.lang.String TEMP_FILE_PREFIX
          Used to prefix all temp files created as part of writing an attachment input stream to disk.
 
Constructor Summary
FileSystemAttachmentDataUtil()
           
 
Method Summary
static void cleanupEmptyAncestors(java.io.File file, java.io.File stopAtFile)
           
static void writeStreamToFile(java.io.InputStream data, java.io.File destFile, java.lang.Long expectedFileSize)
          Writes stream to destination file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMP_FILE_PREFIX

public static final java.lang.String 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 Detail

FileSystemAttachmentDataUtil

public FileSystemAttachmentDataUtil()
Method Detail

writeStreamToFile

public static void writeStreamToFile(java.io.InputStream data,
                                     java.io.File destFile,
                                     java.lang.Long expectedFileSize)
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 stream
destFile - file to copy stream into
expectedFileSize - expected size of the created file. May be null of no size check is to be performed.
Throws:
AttachmentDataStreamSizeMismatchException - if the number of bytes in the stream does not match the expectedAttachmentSize

cleanupEmptyAncestors

public static void cleanupEmptyAncestors(java.io.File file,
                                         java.io.File stopAtFile)


Copyright © 2003-2014 Atlassian. All Rights Reserved.