Delimited structs - this will allow us to skip unrecognised structs.

This commit is contained in:
akwizgran
2013-11-19 18:05:44 +00:00
parent ab5389ce1f
commit 6764ade475
20 changed files with 310 additions and 224 deletions

View File

@@ -40,30 +40,28 @@ public interface Reader {
double readFloat64() throws IOException;
boolean hasString() throws IOException;
String readString() throws IOException;
String readString(int maxLength) throws IOException;
boolean hasBytes() throws IOException;
byte[] readBytes() throws IOException;
byte[] readBytes(int maxLength) throws IOException;
boolean hasList() throws IOException;
<E> List<E> readList(Class<E> e) throws IOException;
boolean hasListStart() throws IOException;
void readListStart() throws IOException;
boolean hasListEnd() throws IOException;
void readListEnd() throws IOException;
boolean hasMap() throws IOException;
<K, V> Map<K, V> readMap(Class<K> k, Class<V> v) throws IOException;
boolean hasMapStart() throws IOException;
void readMapStart() throws IOException;
boolean hasMapEnd() throws IOException;
void readMapEnd() throws IOException;
boolean hasStruct(int id) throws IOException;
void readStructStart(int id) throws IOException;
boolean hasStructEnd() throws IOException;
void readStructEnd() throws IOException;
boolean hasNull() throws IOException;
void readNull() throws IOException;
boolean hasStruct(int id) throws IOException;
void readStructId(int id) throws IOException;
}

View File

@@ -2,11 +2,13 @@ package net.sf.briar.api.serial;
public interface SerialComponent {
int getSerialisedListEndLength();
int getSerialisedListStartLength();
int getSerialisedStructIdLength(int id);
int getSerialisedListEndLength();
int getSerialisedStructStartLength(int id);
int getSerialisedStructEndLength();
int getSerialisedUniqueIdLength();
}

View File

@@ -35,7 +35,8 @@ public interface Writer {
void writeMapStart() throws IOException;
void writeMapEnd() throws IOException;
void writeNull() throws IOException;
void writeStructStart(int id) throws IOException;
void writeStructEnd() throws IOException;
void writeStructId(int id) throws IOException;
void writeNull() throws IOException;
}