@ Override public FSDataOutputStream create ( Path hadoopPath , FsPermission permission , boolean overwrite , int bufferSize , short replication , long blockSize , Progressable progress ) throws IOException { long startTime = System . nanoTime ( ) ; Preconditions . checkArgument ( hadoopPath != null , "hadoopPath must not be null" ) ; Preconditions . checkArgument ( replication > 0 , "replication must be a positive integer: %s" , replication ) ; Preconditions . checkArgument ( blockSize > 0 , "blockSize must be a positive integer: %s" , blockSize ) ; checkOpen ( ) ; logger . atFine ( ) . log ( "GHFS.create: %s, overwrite: %s, bufferSize: %d (ignored)" , hadoopPath , overwrite , bufferSize ) ; URI gcsPath = getGcsPath ( hadoopPath ) ; OutputStreamType type = GCS_OUTPUT_STREAM_TYPE . get ( getConf ( ) , getConf ( ) :: getEnum ) ; OutputStream out ; switch ( type ) { case BASIC : out = new GoogleHadoopOutputStream ( this , gcsPath , statistics , new CreateFileOptions ( overwrite ) ) ; break ; case SYNCABLE_COMPOSITE : out = new GoogleHadoopSyncableOutputStream ( this , gcsPath , statistics , new CreateFileOptions ( overwrite ) ) ; break ; default : throw new IOException ( String . format ( "Unsupported output stream type given for key '%s': '%s'" , GCS_OUTPUT_STREAM_TYPE . getKey ( ) , type ) ) ; } long duration = System . nanoTime ( ) - startTime ; increment ( Counter . CREATE ) ; increment ( Counter . CREATE_TIME , duration ) ; return new FSDataOutputStream ( out , null ) ; }
Opens the given file for writing .