Skip to content

Commit

Permalink
support for running on JRE8 - cast ByteBuffers to "Buffer".
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin Duda committed Feb 19, 2019
1 parent 8043390 commit dfa1c34
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/main/java/com/codingchili/Model/CSVParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import org.reactivestreams.Subscription;

import java.io.*;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.nio.*;
import java.nio.channels.FileChannel;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
Expand Down Expand Up @@ -79,7 +78,7 @@ private byte get() {
private void reset() {
index = 0;
row = 0;
for (MappedByteBuffer map : maps) {
for (Buffer map : maps) {
map.position(0);
}
}
Expand Down Expand Up @@ -135,7 +134,7 @@ private void readHeaders() {
buffer.put(current);
}
}
buffer.clear();
((Buffer) buffer).clear();
}

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

buffer.position(0);
((Buffer) buffer).position(0);
buffer.get(line, 0, read);
line[line.length - 1] = '\0';

Expand All @@ -157,7 +156,7 @@ private void process(AtomicInteger columnsRead, JsonObject json) {
// skip parsing the content - just verify the format.
header.next();
}
buffer.clear();
((Buffer) buffer).clear();
}
}

Expand Down

0 comments on commit dfa1c34

Please sign in to comment.