code: private static synchronized boolean createStorageVolume (final File pToCreate, final long pLength) throws IOException {
          FileOutputStream outStream = null;
          try {
              // if file exists, remove it after questioning.
              if (pToCreate.exists()) {
                  if (!pToCreate.delete()) {
                      LOGGER.debug("Removal of old storage " + pToCreate.toString() + " unsucessful.");
                      return false;
                  }
                  LOGGER.debug("Removal of old storage " + pToCreate.toString() + " sucessful.");
              }
  
              // create file
              final File parent = pToCreate.getCanonicalFile().getParentFile();
              if (!parent.exists() && !parent.mkdirs()) { throw new FileNotFoundException("Unable to create directory: " + parent.getAbsolutePath()); }
  
              pToCreate.createNewFile();
              outStream = new FileOutputStream(pToCreate);
              final FileChannel fcout = outStream.getChannel();
              fcout.position(pLength);
              outStream.write(26); // Write EOF (not normally needed)
              fcout.force(true);
              LOGGER.debug("Creation of storage " + pToCreate.toString() + " sucessful.");
              return true;
          } catch (IOException e) {
              LOGGER.error("Exception creating storage volume " + pToCreate.getAbsolutePath() + ": " + e.getMessage(), e);
              throw e;
          } finally {
              if (outStream != null) {
                  try {
                      outStream.close();
                  } catch (IOException e) {
                      LOGGER.error("Exception closing storage volume: " + e.getMessage(), e);
                  }
              }
          }
  
      }
docs: Creating a new file if not existing at the path defined in the config. Note that it is advised to create the file
  beforehand.
  
  @param pConf configuration to be updated
  @return true if creation successful, false if file already exists.
  @throws IOException if anything weird happens