diff --git a/src/main/java/com/rbkmoney/kebab/Kebab.java b/src/main/java/com/rbkmoney/kebab/Kebab.java index 2d416dd..1870ba2 100644 --- a/src/main/java/com/rbkmoney/kebab/Kebab.java +++ b/src/main/java/com/rbkmoney/kebab/Kebab.java @@ -1,14 +1,11 @@ package com.rbkmoney.kebab; -import com.rbkmoney.kebab.thrift.ThriftElement; import org.apache.thrift.TBase; -import java.util.Map; - /** * Created by tolkonepiu on 24/01/2017. */ -public class Kebab { +public class Kebab { public String toJson(T src) { throw new UnsupportedOperationException("under contruction"); diff --git a/src/main/java/com/rbkmoney/kebab/StructWriter.java b/src/main/java/com/rbkmoney/kebab/StructWriter.java index 98834be..15591e0 100644 --- a/src/main/java/com/rbkmoney/kebab/StructWriter.java +++ b/src/main/java/com/rbkmoney/kebab/StructWriter.java @@ -12,11 +12,11 @@ public interface StructWriter extends Closeable { StructWriter endStruct() throws IOException; - StructWriter beginList() throws IOException; + StructWriter beginList(int size) throws IOException; StructWriter endList() throws IOException; - StructWriter beginMap() throws IOException; + StructWriter beginMap(int size) throws IOException; StructWriter endMap() throws IOException; diff --git a/src/main/java/com/rbkmoney/kebab/exception/BadFormatException.java b/src/main/java/com/rbkmoney/kebab/exception/BadFormatException.java new file mode 100644 index 0000000..7f85d86 --- /dev/null +++ b/src/main/java/com/rbkmoney/kebab/exception/BadFormatException.java @@ -0,0 +1,24 @@ +package com.rbkmoney.kebab.exception; + +import java.io.IOException; + +/** + * Created by tolkonepiu on 31/01/2017. + */ +public class BadFormatException extends IOException { + + public BadFormatException() { + } + + public BadFormatException(String message) { + super(message); + } + + public BadFormatException(String message, Throwable cause) { + super(message, cause); + } + + public BadFormatException(Throwable cause) { + super(cause); + } +} diff --git a/src/main/java/com/rbkmoney/kebab/exception/BadGrammarException.java b/src/main/java/com/rbkmoney/kebab/exception/BadGrammarException.java deleted file mode 100644 index e405c5a..0000000 --- a/src/main/java/com/rbkmoney/kebab/exception/BadGrammarException.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.rbkmoney.kebab.exception; - -/** - * Created by tolkonepiu on 31/01/2017. - */ -public class BadGrammarException { -} diff --git a/src/main/java/com/rbkmoney/kebab/serializer/TBaseSerializer.java b/src/main/java/com/rbkmoney/kebab/serializer/TBaseSerializer.java index f7eb138..cb75105 100644 --- a/src/main/java/com/rbkmoney/kebab/serializer/TBaseSerializer.java +++ b/src/main/java/com/rbkmoney/kebab/serializer/TBaseSerializer.java @@ -43,7 +43,7 @@ public class TBaseSerializer implements Serializer { boolean isBinary = fieldValueMetaData.isBinary(); if (isBinary) { - out.binaryValue((byte[]) object); + out.value((byte[]) object); } else { switch (type) { case BOOLEAN: @@ -83,7 +83,7 @@ public class TBaseSerializer implements Serializer { } private void write(StructWriter out, Set objectSet, SetMetaData metaData) throws IOException { - out.beginList(); + out.beginList(objectSet.size()); for (Object object : objectSet) { write(out, object, metaData.getElementMetaData()); } @@ -91,7 +91,7 @@ public class TBaseSerializer implements Serializer { } private void write(StructWriter out, List objectList, ListMetaData metaData) throws IOException { - out.beginList(); + out.beginList(objectList.size()); for (Object object : objectList) { write(out, object, metaData.getElementMetaData()); } @@ -100,7 +100,7 @@ public class TBaseSerializer implements Serializer { private void write(StructWriter out, Map objectMap, MapMetaData metaData) throws IOException { - out.beginMap(); + out.beginMap(objectMap.size()); for (Map.Entry entry : (Set) objectMap.entrySet()) { out.beginKey(); write(out, entry.getKey(), metaData.getKeyMetaData()); diff --git a/src/main/java/com/rbkmoney/kebab/writer/JsonStructWriter.java b/src/main/java/com/rbkmoney/kebab/writer/JsonStructWriter.java index 83e7520..5fe5a64 100644 --- a/src/main/java/com/rbkmoney/kebab/writer/JsonStructWriter.java +++ b/src/main/java/com/rbkmoney/kebab/writer/JsonStructWriter.java @@ -19,7 +19,7 @@ public class JsonStructWriter implements StructWriter { } @Override - public StructWriter beginList() throws IOException { + public StructWriter beginList(int size) throws IOException { return null; } @@ -29,7 +29,7 @@ public class JsonStructWriter implements StructWriter { } @Override - public StructWriter beginMap() throws IOException { + public StructWriter beginMap(int size) throws IOException { return null; }