소스 검색

Make getFileChecksum a lot faster

Signed-off-by: Jonas Mayer <jonas.a.mayer@gmx.net>
Jonas Mayer 1 년 전
부모
커밋
33dd900882
1개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 3
      app/src/main/java/com/owncloud/android/datamodel/FilesystemDataProvider.java

+ 4 - 3
app/src/main/java/com/owncloud/android/datamodel/FilesystemDataProvider.java

@@ -225,9 +225,10 @@ public class FilesystemDataProvider {
 
         try (InputStream inputStream = new BufferedInputStream(new FileInputStream(filepath))){
             CRC32 crc = new CRC32();
-            int cnt;
-            while ((cnt = inputStream.read()) != -1) {
-                crc.update(cnt);
+            byte[] buf = new byte[1024*64];
+            int size;
+            while ((size = inputStream.read(buf)) > 0) {
+                crc.update(buf,0,size);
             }
 
             return crc.getValue();