@ Override public synchronized int read ( long position , byte [ ] buf , int offset , int length ) throws IOException { long startTime = System . nanoTime ( ) ; int result = super . read ( position , buf , offset , length ) ; if ( result > 0 ) { // -1 means we actually read 0 bytes, but requested at least one byte. statistics . incrementBytesRead ( result ) ; totalBytesRead += result ; } long duration = System . nanoTime ( ) - startTime ; ghfs . increment ( GoogleHadoopFileSystemBase . Counter . READ_POS ) ; ghfs . increment ( GoogleHadoopFileSystemBase . Counter . READ_POS_TIME , duration ) ; return result ; }
Reads up to length bytes from the underlying store and stores them starting at the specified offset in the given buffer . Less than length bytes may be returned . Reading starts at the given position .