Skip to content

Commit 2f689f6

Browse files
committed
Remove CharBufferReader from JsonArbitraryFieldNameBenchmark
1 parent 49100a7 commit 2f689f6

File tree

1 file changed

+0
-74
lines changed

1 file changed

+0
-74
lines changed

src/main/java/com/fasterxml/jackson/perf/json/JsonArbitraryFieldNameBenchmark.java

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525
import java.io.ByteArrayInputStream;
2626
import java.io.IOException;
2727
import java.io.InputStreamReader;
28-
import java.io.Reader;
2928
import java.io.StringReader;
30-
import java.nio.ByteBuffer;
31-
import java.nio.CharBuffer;
3229
import java.nio.charset.Charset;
3330
import java.nio.charset.StandardCharsets;
3431
import java.util.Map;
@@ -85,15 +82,6 @@ JsonParser create(JsonFactory factory, Supplier<byte[]> bytesSupplier) throws IO
8582
StandardCharsets.UTF_8));
8683
}
8784
},
88-
CHAR_READER() {
89-
@Override
90-
JsonParser create(JsonFactory factory, Supplier<byte[]> jsonSupplier) throws IOException {
91-
ByteBuffer byteBuffer = ByteBuffer.wrap(jsonSupplier.get());
92-
CharBuffer charBuffer = Charset.forName("UTF-8").decode(byteBuffer);
93-
CharBufferReader charBufferReader = new CharBufferReader(charBuffer);
94-
return factory.createParser(charBufferReader);
95-
}
96-
},
9785
STRING_READER() {
9886
@Override
9987
JsonParser create(JsonFactory factory, Supplier<byte[]> jsonSupplier) throws IOException {
@@ -200,68 +188,6 @@ public static final class SimpleClass {
200188
public String stringThree;
201189
}
202190

203-
public static class CharBufferReader extends Reader {
204-
private final CharBuffer charBuffer;
205-
206-
public CharBufferReader(CharBuffer buffer) {
207-
this.charBuffer = buffer.duplicate();
208-
}
209-
210-
@Override
211-
public int read(char[] chars, int off, int len) {
212-
int remaining = this.charBuffer.remaining();
213-
if (remaining <= 0) {
214-
return -1;
215-
}
216-
int length = Math.min(len, remaining);
217-
this.charBuffer.get(chars, off, length);
218-
return length;
219-
}
220-
221-
@Override
222-
public int read() {
223-
if (this.charBuffer.hasRemaining()) {
224-
return this.charBuffer.get();
225-
}
226-
return -1;
227-
}
228-
229-
@Override
230-
public long skip(long n) {
231-
if (n < 0L) {
232-
throw new IllegalArgumentException("number of characters to skip cannot be negative");
233-
}
234-
int skipped = Math.min((int) n, this.charBuffer.remaining());
235-
this.charBuffer.position(this.charBuffer.position() + skipped);
236-
return skipped;
237-
}
238-
239-
@Override
240-
public boolean ready() {
241-
return true;
242-
}
243-
244-
@Override
245-
public boolean markSupported() {
246-
return true;
247-
}
248-
249-
@Override
250-
public void mark(int readAheadLimit) {
251-
this.charBuffer.mark();
252-
}
253-
254-
@Override
255-
public void reset() {
256-
this.charBuffer.reset();
257-
}
258-
259-
@Override
260-
public void close() {
261-
this.charBuffer.position(this.charBuffer.limit());
262-
}
263-
}
264-
265191
public static void main(String[] _args) throws Exception {
266192
new Runner(new OptionsBuilder()
267193
.include(JsonArbitraryFieldNameBenchmark.class.getName())

0 commit comments

Comments
 (0)