org.duracloud.chunk
Class FileChunker

java.lang.Object
  extended by 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
FileChunker(ContentWriter contentWriter)
           
FileChunker(ContentWriter contentWriter, FileChunkerOptions options)
           
 
Method Summary
 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
protected  void addContentFrom(File baseDir, String destSpaceId)
          This method loops the arg baseDir and pushes the found content to the arg destSpace.
static DigestInputStream createTestContent(File outFile, long size)
          This method generates a test file with random char content.
protected  void writeReport(File outputFile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 destination
destContentId - of content
fileChecksum - MD5 checksum of file or null if not known
file - to add

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 DataStore
destSpaceId - 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 file
size - number of bytes in test file
Returns:
DigestInputStream of test file
Throws:
IOException - on error


Copyright © 2009-2011 DuraSpace. All Rights Reserved.