lib/src/main/java/edu/berkeley/boinc/rpc/RpcClient.java
protected String receiveReply() throws IOException {
		mResult.setLength(0);
		if (Logging.RPC_PERFORMANCE) if(Logging.DEBUG) Log.d(Logging.TAG, "mResult.capacity() = " + mResult.capacity());

		long readStart = System.nanoTime();

		// Speed is (with large data): ~ 45 KB/s for buffer size 1024
		//                             ~ 90 KB/s for buffer size 2048
		//                             ~ 95 KB/s for buffer size 4096
		// The chosen buffer size is 2048
		int bytesRead;
		if (mInput == null)
			return mResult.toString();	// empty string
		do {
			bytesRead = mInput.read(mReadBuffer);
			if (bytesRead == -1) break;
			mResult.append(new String(mReadBuffer, 0, bytesRead));
			if (mReadBuffer[bytesRead-1] == '\003') {
				// Last read byte marks the end of transfer
				mResult.setLength(mResult.length() - 1);
				break;
			}
		} while (true);

		if (Logging.RPC_PERFORMANCE) {
			float duration = (System.nanoTime() - readStart)/1000000000.0F;
			long bytesCount = mResult.length();
			if (duration == 0) duration = 0.001F;
			if(Logging.DEBUG) Log.d(Logging.TAG, "Reading from socket took " + duration + " seconds, " + bytesCount + " bytes read (" + (bytesCount / duration) + " bytes/second)");
		}

		if (Logging.RPC_PERFORMANCE) if(Logging.DEBUG) Log.d(Logging.TAG, "mResult.capacity() = " + mResult.capacity());

		if (Logging.RPC_DATA) {
			BufferedReader dbr = new BufferedReader(new StringReader(mResult.toString()));
			String dl;
			int ln = 0;
			try {
				while ((dl = BOINCUtils.readLineLimit(dbr, 4096)) != null) {
					++ln;
					if(Logging.DEBUG) Log.d(Logging.TAG, String.format("%4d: %s", ln, dl));
				}
			}
			catch (IOException ioe) {
			}
		}
		return mResult.toString();
	}
/**
	 * Read the reply from BOINC core client
	 * @return the data read from socket
	 * @throws IOException if error occurs when reading from socket
	 */
Read the reply from BOINC core client
@return the data read from socket
@throws IOException if error occurs when reading from socket
Read the reply from BOINC core client @return the data read from socket @throws IOException if error occurs when reading from socket
protected String receiveReply() throws IOException {
		mResult.setLength(0);
		if (Logging.RPC_PERFORMANCE) if(Logging.DEBUG) Log.d(Logging.TAG, "mResult.capacity() = " + mResult.capacity());
		long readStart = System.nanoTime();
		int bytesRead;
		if (mInput == null)
			return mResult.toString();	
		do {
			bytesRead = mInput.read(mReadBuffer);
			if (bytesRead == -1) break;
			mResult.append(new String(mReadBuffer, 0, bytesRead));
			if (mReadBuffer[bytesRead-1] == '\003') {
				mResult.setLength(mResult.length() - 1);
				break;
			}
		} while (true);
		if (Logging.RPC_PERFORMANCE) {
			float duration = (System.nanoTime() - readStart)/1000000000.0F;
			long bytesCount = mResult.length();
			if (duration == 0) duration = 0.001F;
			if(Logging.DEBUG) Log.d(Logging.TAG, "Reading from socket took " + duration + " seconds, " + bytesCount + " bytes read (" + (bytesCount / duration) + " bytes/second)");
		}
		if (Logging.RPC_PERFORMANCE) if(Logging.DEBUG) Log.d(Logging.TAG, "mResult.capacity() = " + mResult.capacity());
		if (Logging.RPC_DATA) {
			BufferedReader dbr = new BufferedReader(new StringReader(mResult.toString()));
			String dl;
			int ln = 0;
			try {
				while ((dl = BOINCUtils.readLineLimit(dbr, 4096)) != null) {
					++ln;
					if(Logging.DEBUG) Log.d(Logging.TAG, String.format("%4d: %s", ln, dl));
				}
			}
			catch (IOException ioe) {
			}
		}
		return mResult.toString();
	}
protected String receiveReply ( ) throws IOException { mResult . setLength ( 0 ) ; if ( Logging . RPC_PERFORMANCE ) if ( Logging . DEBUG ) Log . d ( Logging . TAG , "mResult.capacity() = " + mResult . capacity ( ) ) ; long readStart = System . nanoTime ( ) ; int bytesRead ; if ( mInput == null ) return mResult . toString ( ) ; do { bytesRead = mInput . read ( mReadBuffer ) ; if ( bytesRead == - 1 ) break ; mResult . append ( new String ( mReadBuffer , 0 , bytesRead ) ) ; if ( mReadBuffer [ bytesRead - 1 ] == '\003' ) { mResult . setLength ( mResult . length ( ) - 1 ) ; break ; } } while ( true ) ; if ( Logging . RPC_PERFORMANCE ) { float duration = ( System . nanoTime ( ) - readStart ) / 1000000000.0F ; long bytesCount = mResult . length ( ) ; if ( duration == 0 ) duration = 0.001F ; if ( Logging . DEBUG ) Log . d ( Logging . TAG , "Reading from socket took " + duration + " seconds, " + bytesCount + " bytes read (" + ( bytesCount / duration ) + " bytes/second)" ) ; } if ( Logging . RPC_PERFORMANCE ) if ( Logging . DEBUG ) Log . d ( Logging . TAG , "mResult.capacity() = " + mResult . capacity ( ) ) ; if ( Logging . RPC_DATA ) { BufferedReader dbr = new BufferedReader ( new StringReader ( mResult . toString ( ) ) ) ; String dl ; int ln = 0 ; try { while ( ( dl = BOINCUtils . readLineLimit ( dbr , 4096 ) ) != null ) { ++ ln ; if ( Logging . DEBUG ) Log . d ( Logging . TAG , String . format ( "%4d: %s" , ln , dl ) ) ; } } catch ( IOException ioe ) { } } return mResult . toString ( ) ; }
Read the reply from BOINC core client
 @return the data read from socket
 @throws IOException if error occurs when reading from socket
Read the reply from BOINC core client @return the data read from socket @throws IOException if error occurs when reading from socket
// Speed is (with large data): ~ 45 KB/s for buffer size 1024 //                             ~ 90 KB/s for buffer size 2048 //                             ~ 95 KB/s for buffer size 4096 // The chosen buffer size is 2048 // empty string // Last read byte marks the end of transfer