Skip to content

Commit 213ca31

Browse files
committed
msgpack: eliminate support for ByteBuffer
MsgPackLite is not a public API and is used internally by Tarantool client to (de-)serialize iproto packets. Code analysis and code coverage shows that ByteBuffer is not passed as an argument to be serialized (see https://coveralls.io/builds/27255963/source?filename=src/main/java/org/tarantool/MsgPackLite.java#L172). To keep code simplified this code branch was removed as unused.
1 parent 061c8d4 commit 213ca31

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

src/main/java/org/tarantool/MsgPackLite.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -164,21 +164,8 @@ public void pack(Object item, OutputStream os) throws IOException {
164164
out.writeInt(data.length);
165165
}
166166
out.write(data);
167-
} else if (item instanceof byte[] || item instanceof ByteBuffer) {
168-
byte[] data;
169-
if (item instanceof byte[]) {
170-
data = (byte[]) item;
171-
} else {
172-
ByteBuffer bb = ((ByteBuffer) item);
173-
if (bb.hasArray()) {
174-
data = bb.array();
175-
} else {
176-
data = new byte[bb.capacity()];
177-
bb.position();
178-
bb.limit(bb.capacity());
179-
bb.get(data);
180-
}
181-
}
167+
} else if (item instanceof byte[]) {
168+
byte[] data = (byte[]) item;
182169
if (data.length <= MAX_8BIT) {
183170
out.write(MP_BIN8);
184171
out.writeByte(data.length);

0 commit comments

Comments
 (0)