question: @ Nullable private static String read ( @ NonNull SocketChannel socket , @ NonNull byte [ ] buffer ) throws IOException { ByteBuffer buf = ByteBuffer . wrap ( buffer , 0 , buffer . length ) ; while ( buf . position ( ) != buf . limit ( ) ) { int count ; count = socket . read ( buf ) ; if ( count < 0 ) { throw new IOException ( "EOF" ) ; } } try { return new String ( buffer , 0 , buf . position ( ) , AdbHelper . DEFAULT_ENCODING ) ; } catch ( UnsupportedEncodingException e ) { return null ; } }
target:  Fills a buffer by reading data from a socket.