1- /**
2-
1+ /**
2+
33Copyright 2013 Intel Corporation, All Rights Reserved.
44
55Licensed under the Apache License, Version 2.0 (the "License");
1212distributed under the License is distributed on an "AS IS" BASIS,
1313WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414See the License for the specific language governing permissions and
15- limitations under the License.
16- */
15+ limitations under the License.
16+ */
1717
1818package com .intel .cosbench .driver .operator ;
1919
3232
3333/**
3434 * This class represents primitive READ operation.
35- *
35+ *
3636 * @author ywang19, qzheng7
37- *
37+ *
3838 */
3939class Reader extends AbstractOperator {
4040
4141 public static final String OP_TYPE = "read" ;
42-
42+
4343 private boolean hashCheck = false ;
4444
4545 private ObjectPicker objPicker = new ObjectPicker ();
46-
46+
4747 private byte buffer [] = new byte [1024 *1024 ];
4848
4949 public Reader () {
@@ -101,7 +101,7 @@ private Sample doRead(OutputStream out, String conName, String objName,
101101 } catch (Exception e ) {
102102 isUnauthorizedException (e , session );
103103 errorStatisticsHandle (e , session , conName + "/" + objName );
104-
104+
105105 return new Sample (new Date (), getId (), getOpType (), getSampleType (), getName (), false );
106106 } finally {
107107 IOUtils .closeQuietly (in );
@@ -117,14 +117,11 @@ private Sample doRead(OutputStream out, String conName, String objName,
117117 public OutputStream copyLarge (InputStream input , OutputStream output )
118118 throws IOException
119119 {
120- for (int n = 0 ; -1 != (n = input .read (buffer ));)
121- {
122- output .write (buffer , 0 , n );
123- }
120+ IOUtils .copyLarge (input , output );
124121
125122 return output ;
126123 }
127-
124+
128125 private static boolean validateChecksum (String conName , String objName ,
129126 Session session , InputStream in , OutputStream out )
130127 throws IOException {
@@ -138,7 +135,7 @@ private static boolean validateChecksum(String conName, String objName,
138135
139136 String storedHash = new String ();
140137 String calculatedHash = new String ();
141-
138+
142139 int br1 = in .read (buf1 );
143140
144141 if (br1 <= hashLen ) {
0 commit comments