Commit da6f59c3 authored by Evgeny Kusmenko's avatar Evgeny Kusmenko
Browse files

Merge branch 'dev_ema' into 'master'

Bugfix for SimplePacketType and binary encoding for StructType

See merge request !14
parents 395e9818 460e924f
Pipeline #423914 failed with stage
in 1 minute and 1 second
......@@ -41,7 +41,8 @@ public class SimplePacketType extends DataType {
@Override
public int getDataSize(Object o) {
return HEADER_SIZE + payloadType.getDataSize(o);
Object[] arr = (Object[]) o;
return HEADER_SIZE + payloadType.getDataSize(arr[1]);
}
@Override
......
......@@ -189,12 +189,19 @@ public class StructType extends DataType implements CustomJson {
@Override
public void toBinary(DataOutputStream os, Object o) throws IOException {
throw new IllegalArgumentException("Unimplemented");
Object[] arr = (Object[]) o;
for(int i=0;i<this.getFieldCount();i++){
field_types.elementAt(i).toBinary(os, arr[i]);
}
}
@Override
public Object fromBinary(DataInputStream is) throws IOException {
throw new IllegalArgumentException("Unimplemented");
Object[] arr = new Object[this.getFieldCount()];
for(int i=0;i<arr.length;i++){
arr[i] = this.field_types.elementAt(i).fromBinary(is);
}
return (Object) arr;
}
@Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment