private static void writeFile ( CyclicBarrier barrier , AtomicLong runtime , int count , AlluxioConfiguration alluxioConf ) throws Exception { FileSystem fileSystem = FileSystem . Factory . create ( alluxioConf ) ; byte [ ] buffer = new byte [ ( int ) Math . min ( sFileSize , 4 * Constants . MB ) ] ; Arrays . fill ( buffer , ( byte ) ' ' ) ; AlluxioURI path = filename ( count ) ; if ( fileSystem . exists ( path ) ) { fileSystem . delete ( path ) ; } barrier . await ( ) ; long startTime = System . nanoTime ( ) ; long bytesWritten = 0 ; try ( FileOutStream outStream = fileSystem . createFile ( path ) ) { while ( bytesWritten < sFileSize ) { outStream . write ( buffer , 0 , ( int ) Math . min ( buffer . length , sFileSize - bytesWritten ) ) ; bytesWritten += buffer . length ; } } runtime . addAndGet ( System . nanoTime ( ) - startTime ) ; }
Writes a file .