Package org.duracloud.chunk
Class FileChunker
java.lang.Object
org.duracloud.chunk.FileChunker
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
ConstructorsConstructorDescriptionFileChunker(ContentWriter contentWriter) FileChunker(ContentWriter contentWriter, FileChunkerOptions options) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddContent(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 Details
-
FileChunker
-
FileChunker
-
-
Method Details
-
writeReport
-
addContent
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
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
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
-