Package org.duracloud.chunk
Class FileChunker
- java.lang.Object
-
- org.duracloud.chunk.FileChunker
-
public class FileChunker extends Object
This class provides the ability to loop over a directory of content which may include files over 5-GB in size, chunk, and push them to a DataStore encapsulated by the member: ContentWriter. A ContentWriter may push to any DataStore, such as: - a filesystem or - a DuraCloud space- Author:
- Andrew Woods Date: Feb 4, 2010
-
-
Constructor Summary
Constructors Constructor Description FileChunker(ContentWriter contentWriter)FileChunker(ContentWriter contentWriter, FileChunkerOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddContent(String destSpaceId, String destContentId, String fileChecksum, long fileSize, InputStream stream, Map<String,String> properties)This method pushes the content file to the space destSpaceId with the content ID destContentIdvoidaddContent(String destSpaceId, String destContentId, String fileChecksum, File file)This method pushes the content file to the space destSpaceId with the content ID destContentIdprotected voidaddContentFrom(File baseDir, String destSpaceId)This method loops the arg baseDir and pushes the found content to the arg destSpace.static DigestInputStreamcreateTestContent(File outFile, long size)This method generates a test file with random char content.protected voidwriteReport(File outputFile)
-
-
-
Constructor Detail
-
FileChunker
public FileChunker(ContentWriter contentWriter)
-
FileChunker
public FileChunker(ContentWriter contentWriter, FileChunkerOptions options)
-
-
Method Detail
-
writeReport
protected void writeReport(File outputFile)
-
addContent
public void addContent(String destSpaceId, String destContentId, String fileChecksum, File file)
This method pushes the content file to the space destSpaceId with the content ID destContentId- Parameters:
destSpaceId- of content destinationdestContentId- of contentfileChecksum- MD5 checksum of file or null if not knownfile- to add
-
addContent
public void addContent(String destSpaceId, String destContentId, String fileChecksum, long fileSize, InputStream stream, Map<String,String> properties)
This method pushes the content file to the space destSpaceId with the content ID destContentId- Parameters:
destSpaceId- of content destinationdestContentId- of contentfileChecksum- MD5 checksum of file or null if not knownstream- to addproperties- user-defined properties associated with content
-
addContentFrom
protected void addContentFrom(File baseDir, String destSpaceId)
This method loops the arg baseDir and pushes the found content to the arg destSpace.- Parameters:
baseDir- of content to push to DataStoredestSpaceId- of content destination
-
createTestContent
public static DigestInputStream createTestContent(File outFile, long size) throws IOException
This method generates a test file with random char content.- Parameters:
outFile- of test filesize- number of bytes in test file- Returns:
- DigestInputStream of test file
- Throws:
IOException- on error
-
-