org.eclipse.emf.emfstore.internal.server.filetransfer
Class FilePartitionerUtil

java.lang.Object
  extended by org.eclipse.emf.emfstore.internal.server.filetransfer.FilePartitionerUtil

public final class FilePartitionerUtil
extends Object

File transfer utility class.

Author:
pfeifferc

Method Summary
static int getChunkSize()
           
static int getFileSize(File file)
           
static int getNumberOfChunks(File file)
          Returns the number of chunks for a given file.
static FileChunk readChunk(File file, FileTransferInformation fileInformation)
          Reads a file chunk from a file.
static void writeChunk(File file, FileChunk fileChunk)
          Writes a file chunk to a file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

writeChunk

public static void writeChunk(File file,
                              FileChunk fileChunk)
                       throws FileTransferException
Writes a file chunk to a file.

Parameters:
file - file to be written to
fileChunk - file chunk
Throws:
FileTransferException - if any error occurs writing to the file.

readChunk

public static FileChunk readChunk(File file,
                                  FileTransferInformation fileInformation)
                           throws FileTransferException
Reads a file chunk from a file.

Parameters:
file - to be read from
fileInformation - containing file transfer attributes
Returns:
fileChunk
Throws:
FileTransferException - if any error occurs reading the file

getNumberOfChunks

public static int getNumberOfChunks(File file)
                             throws FileTransferException
Returns the number of chunks for a given file.

Parameters:
file - file
Returns:
number of chunks
Throws:
FileTransferException - if any error occurs obtaining the file handle.

getFileSize

public static int getFileSize(File file)
                       throws FileTransferException
Parameters:
file - file
Returns:
file size
Throws:
FileTransferException - if any error occurs reading file size

getChunkSize

public static int getChunkSize()
Returns:
the chunk size


Copyright © 2015. All Rights Reserved.