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 Details

  • Method Details

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