milenkovicm / avro-netty Goto Github PK
View Code? Open in Web Editor NEWAvro Encoder/Decoder implemented using Netty ByteBuf
License: Apache License 2.0
Avro Encoder/Decoder implemented using Netty ByteBuf
License: Apache License 2.0
from readInt and readString in ByteBufDecoder
when reading from ByteBuf to decoder
I found the exception throws from here:
Netty 4.0.33 io.netty.buffer.AbstractByteBuf.java line 1178
private void checkReadableBytes0(int minimumReadableBytes) {
ensureAccessible();
if (readerIndex > writerIndex - minimumReadableBytes) {
throw new IndexOutOfBoundsException(String.format(
"readerIndex(%d) + length(%d) exceeds writerIndex(%d): %s",
readerIndex, minimumReadableBytes, writerIndex, this));
}
}
Caused by: java.lang.IndexOutOfBoundsException
at io.netty.buffer.EmptyByteBuf.readUnsignedByte(EmptyByteBuf.java:445)
at com.github.milenkovicm.avro.io.ByteBufDecoder.readInt(ByteBufDecoder.java:38)
at com.github.milenkovicm.avro.io.ByteBufDecoder.readString(ByteBufDecoder.java:91)
at org.apache.avro.io.ResolvingDecoder.readString(ResolvingDecoder.java:201)
at org.apache.avro.generic.GenericDatumReader.readString(GenericDatumReader.java:430)
at org.apache.avro.generic.GenericDatumReader.readString(GenericDatumReader.java:422)
avro schema:
{"namespace": "example.avro",
"type": "record",
"name": "User",
"fields": [
{"name": "name", "type": "string"},
{"name": "favorite_number", "type": ["int", "null"]},
{"name": "favorite_color", "type": ["string", "null"]}
]
}
Hi, I have a question about the demo decoder in README.
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
//Do we need to handle TCP splicing here before DatumReader read?
final NettyByteBufDecoder decoder = new NettyByteBufDecoder(in);
final DatumReader<GenericRecord> reader = new GenericDatumReader<>(schema);
try {
final GenericRecord record = reader.read(null, decoder);
out.add(record);
} catch (final IOException e) {
throw new RuntimeException(e);
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.