public static int splitFile(File file, FileOperation fOper)
			throws FileShareException {
		Integer outFileCounter = 0;
		try {
			int bufferSize = ConfigUtils.getInteger(ConfigKeys.FileReadBufferSize);
			byte[] dataBuffer = new byte[bufferSize];
			int readBytes = 0;
			
			String outFileNamePrefix = ConfigUtils.getString(ConfigKeys.PartsDirectory) + "/" 
				+ fOper + "/"+ file.getName() + ConfigUtils.getString(ConfigKeys.PartSuffix);
			String outFileName = outFileNamePrefix + outFileCounter.toString();
			
			FileInputStream fIStream = new FileInputStream(file);
			FileOutputStream fOStream = null;
			File outFile = null;
			
			// Start reading the input file
			while((readBytes = fIStream.read(dataBuffer)) != -1) {
				if (ConfigUtils.isDebug()) {
					ApplicationUtils.printLine("Read from file (bytes): " + readBytes);
				}
				
				if (null == fOStream) {
					// Create the output part file if it does not exist
					try {
						if (ConfigUtils.isDebug()) {
							ApplicationUtils.printLine("Creating output file: " + outFileName);
						}
						outFile = new File(outFileName);
						outFile.getParentFile().mkdirs();
						outFile.createNewFile();
						// Increment the count of part files
						outFileCounter++;
						fOStream = new FileOutputStream(outFile);
					} catch (FileNotFoundException e) {
						fIStream.close();
						fOStream.close();
						throw new FileShareException("ERR: Could not create the part file: " + outFileName, e);
					}
				}
				
				// Write the bytes read from input file into the part file
				fOStream.write(dataBuffer, 0, readBytes);
				
				// If we cannot read into this part file again, open the next part file.
				if (outFile.length() + bufferSize > ConfigUtils.getInteger(ConfigKeys.PartSize)) {
					fOStream.close();
					fOStream = null;
					outFileName = outFileNamePrefix + outFileCounter;
				}
			}
			
			// Close all streams
			fOStream.close();
			fIStream.close();
		}
		catch (IOException e) {
			throw new FileShareException("ERR: Could not split into parts: " + file.getName(), e);
		}
		
		// Indicate success
		return outFileCounter;
	}