public void writeFile(String name,String mimeType,File file) throws IOException {
  if (file == null) {
    throw new IllegalArgumentException("File cannot be null.");
  }
  if (!file.exists()) {
    throw new IllegalArgumentException("File does not exist.");
  }
  if (file.isDirectory()) {
    throw new IllegalArgumentException("File cannot be a directory.");
  }
  writeFile(name,mimeType,file.getCanonicalPath(),new FileInputStream(file));
}

public void writeFile ( String name , String mimeType , File file ) throws IOException { if ( file == null ) { throw new IllegalArgumentException ( "File cannot be null." ) ; } if ( ! file . exists ( ) ) { throw new IllegalArgumentException ( "File does not exist." ) ; } if ( file . isDirectory ( ) ) { throw new IllegalArgumentException ( "File cannot be a directory." ) ; } writeFile ( name , mimeType , file . getCanonicalPath ( ) , new FileInputStream ( file ) ) ; }
writes a file ' s contents .
