Skip to content

Commit dfa1c34

Browse files
author
Robin Duda
committed
support for running on JRE8 - cast ByteBuffers to "Buffer".
1 parent 8043390 commit dfa1c34

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/main/java/com/codingchili/Model/CSVParser.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
import org.reactivestreams.Subscription;
77

88
import java.io.*;
9-
import java.nio.ByteBuffer;
10-
import java.nio.MappedByteBuffer;
9+
import java.nio.*;
1110
import java.nio.channels.FileChannel;
1211
import java.util.*;
1312
import java.util.concurrent.atomic.AtomicInteger;
@@ -79,7 +78,7 @@ private byte get() {
7978
private void reset() {
8079
index = 0;
8180
row = 0;
82-
for (MappedByteBuffer map : maps) {
81+
for (Buffer map : maps) {
8382
map.position(0);
8483
}
8584
}
@@ -135,7 +134,7 @@ private void readHeaders() {
135134
buffer.put(current);
136135
}
137136
}
138-
buffer.clear();
137+
((Buffer) buffer).clear();
139138
}
140139

141140
private void process(AtomicInteger columnsRead, JsonObject json) {
@@ -148,7 +147,7 @@ private void process(AtomicInteger columnsRead, JsonObject json) {
148147
int read = buffer.position();
149148
byte[] line = new byte[read + 1];
150149

151-
buffer.position(0);
150+
((Buffer) buffer).position(0);
152151
buffer.get(line, 0, read);
153152
line[line.length - 1] = '\0';
154153

@@ -157,7 +156,7 @@ private void process(AtomicInteger columnsRead, JsonObject json) {
157156
// skip parsing the content - just verify the format.
158157
header.next();
159158
}
160-
buffer.clear();
159+
((Buffer) buffer).clear();
161160
}
162161
}
163162

0 commit comments

Comments
 (0)