Class SlicedTransferFileHandler
- java.lang.Object
-
- org.pipecraft.infra.storage.google_cs.SlicedTransferFileHandler
-
public class SlicedTransferFileHandler extends Object
Takes part in sliced transfer, making sure that: 1) The local file writer is created lazilly, only when we start downloading a slice belonging to the file 2) The local file's writer is closed immediately after writing the last slice of the file- Author:
- Eyal Schneider
-
-
Constructor Summary
Constructors Constructor Description SlicedTransferFileHandler(File file, int fileSliceCount)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoneSliceProcessing()Call this method each time a slice download for this file is complete.FileChannelgetWriter()
-
-
-
Constructor Detail
-
SlicedTransferFileHandler
public SlicedTransferFileHandler(File file, int fileSliceCount)
Constructor- Parameters:
file- The local file we are writing tofileSliceCount- The total number of slices to be written to the file
-
-
Method Detail
-
getWriter
public FileChannel getWriter() throws IOException
- Returns:
- The writer to be used for writing to the local file. Created lazilly.
- Throws:
IOException- In case the file can't be created
-
doneSliceProcessing
public void doneSliceProcessing() throws IOExceptionCall this method each time a slice download for this file is complete. Once the method detects all slices are complete, the file is closed- Throws:
IOException- In case the file can't be closed
-
-