Commit 6b6da1ce authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

temporarily unbroke java register: stop sending type defs

parent ddb59c80
......@@ -27,16 +27,19 @@ public class EncoderChannel implements Encoder {
}
public void register(SampleDispatcher dispatcher) throws IOException {
int index = def_registry.add(dispatcher);
begin(Constant.SAMPLE_DEF);
encodePacked32(index);
encodeString(dispatcher.getName());
byte[] signature = dispatcher.getSignature();
encodePacked32(signature.length);
for (int i = 0 ; i < signature.length ; i++) {
encodeByte(signature[i]);
if(dispatcher.getTypeDeclTag() == Constant.SAMPLE_DEF) {
int index = def_registry.add(dispatcher);
//begin(Constant.SAMPLE_DEF);
begin(dispatcher.getTypeDeclTag());
encodePacked32(index);
encodeString(dispatcher.getName());
byte[] signature = dispatcher.getSignature();
encodePacked32(signature.length);
for (int i = 0 ; i < signature.length ; i++) {
encodeByte(signature[i]);
}
end(null);
}
end(null);
}
public void registerSampleRef(SampleDispatcher dispatcher) throws IOException {
......
......@@ -11,5 +11,11 @@ public interface SampleDispatcher <T> {
public void decodeAndHandle(Decoder decoder,
SampleHandler handler) throws Exception;
/** return the tag SAMPLE_DEF or TYPE_DEF, for use
* by encoder.register.
* TODO: refactor types, moving this to a super-interface
* applicable to both type and sample defs.
*/
public byte getTypeDeclTag();
}
......@@ -848,7 +848,7 @@ class Decoder(Codec):
decl = self.index_to_decl[index].decode_decl(self)
value = None
elif index < i_USER:
raise exception("Invalid type index %d" % index)
raise Exception("Invalid type index %d" % index)
else:
decl = self.index_to_decl[index]
value = decl.decode(self)
......
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