Skip to content

Commit 7c5f99c

Browse files
committed
do not read byte for byte
1 parent 4ebd288 commit 7c5f99c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/HelperGeneric.java

+3-6
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565

6666
import java.io.BufferedInputStream;
6767
import java.io.File;
68+
import java.io.FileInputStream;
6869
import java.io.IOException;
6970
import java.io.InputStream;
7071
import java.io.RandomAccessFile;
@@ -1985,7 +1986,7 @@ public void run()
19851986

19861987
static byte[] read_chunk_from_SD_file(String file_name_with_path, long position, long file_chunk_length, boolean real_file_path)
19871988
{
1988-
byte[] out = new byte[(int) file_chunk_length];
1989+
final byte[] out = new byte[(int) file_chunk_length];
19891990

19901991
if (real_file_path)
19911992
{
@@ -1996,11 +1997,7 @@ static byte[] read_chunk_from_SD_file(String file_name_with_path, long position,
19961997
MappedByteBuffer buffer = inChannel.map(FileChannel.MapMode.READ_ONLY, position, file_chunk_length);
19971998

19981999
// Log.i(TAG, "read_chunk_from_SD_file:" + buffer.limit() + " <-> " + file_chunk_length);
1999-
2000-
for (int i = 0; i < buffer.limit(); i++)
2001-
{
2002-
out[i] = buffer.get();
2003-
}
2000+
buffer.get(out);
20042001

20052002
try
20062003
{

0 commit comments

Comments
 (0)