File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
src/main/java/com/maxmind/db Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -51,11 +51,11 @@ final class BufferHolder {
5151 if (null == stream ) {
5252 throw new NullPointerException ("Unable to use a NULL InputStream" );
5353 }
54- final int CHUNK_SIZE = 16 * 1024 ;
54+ final int chunk_size = 16 * 1024 ;
5555 List <byte []> chunks = new ArrayList <>();
5656 long total = 0 ;
5757 int read ;
58- byte [] tmp = new byte [CHUNK_SIZE ];
58+ byte [] tmp = new byte [chunk_size ];
5959
6060 while (-1 != (read = stream .read (tmp ))) {
6161 byte [] copy = new byte [read ];
Original file line number Diff line number Diff line change 22
33import java .io .IOException ;
44import java .nio .ByteBuffer ;
5+ import java .nio .CharBuffer ;
56import java .nio .channels .FileChannel ;
67import java .nio .charset .CharacterCodingException ;
78import java .nio .charset .CharsetDecoder ;
8- import java .nio .CharBuffer ;
99import java .nio .charset .CoderResult ;
1010import java .util .ArrayList ;
1111import java .util .List ;
@@ -201,10 +201,14 @@ public long readFrom(FileChannel channel) throws IOException {
201201 ByteBuffer buf = buffers .get (i );
202202 buf .position ((int ) (pos % CHUNK_SIZE ));
203203 int read = channel .read (buf );
204- if (read == -1 ) break ;
204+ if (read == -1 ) {
205+ break ;
206+ }
205207 totalRead += read ;
206208 pos += read ;
207- if (pos >= limit ) break ;
209+ if (pos >= limit ) {
210+ break ;
211+ }
208212 }
209213 position = pos ;
210214 return totalRead ;
You can’t perform that action at this time.
0 commit comments