@Override public void writeTo(OutputStream os) throws IOException { DataOutputStream dos = new DataOutputStream(os); if (primaryKey != null) dos.write(SchemaType.OBJECT.getTypeIdWithPrimaryKey()); else dos.write(SchemaType.OBJECT.getTypeId()); dos.writeUTF(getName()); if (primaryKey != null) { VarInt.writeVInt(dos, primaryKey.numFields()); for (int i = 0; i < primaryKey.numFields(); i++) { dos.writeUTF(primaryKey.getFieldPath(i)); } } dos.writeShort(size); for(int i=0;i<size;i++) { dos.writeUTF(fieldNames[i]); dos.writeUTF(fieldTypes[i].name()); if(fieldTypes[i] == FieldType.REFERENCE) dos.writeUTF(referencedTypes[i]); } }
@Override public void writeTo(OutputStream os) throws IOException { DataOutputStream dos = new DataOutputStream(os); if(getHashKey() != null) dos.write(SchemaType.MAP.getTypeIdWithPrimaryKey()); else dos.write(SchemaType.MAP.getTypeId()); dos.writeUTF(getName()); dos.writeUTF(getKeyType()); dos.writeUTF(getValueType()); if(getHashKey() != null) { VarInt.writeVInt(dos, getHashKey().numFields()); for(int i=0;i<getHashKey().numFields();i++) { dos.writeUTF(getHashKey().getFieldPath(i)); } } }
@Override public void writeTo(OutputStream os) throws IOException { DataOutputStream dos = new DataOutputStream(os); if(getHashKey() != null) dos.write(SchemaType.SET.getTypeIdWithPrimaryKey()); else dos.write(SchemaType.SET.getTypeId()); dos.writeUTF(getName()); dos.writeUTF(getElementType()); if(getHashKey() != null) { VarInt.writeVInt(dos, getHashKey().numFields()); for(int i=0;i<getHashKey().numFields();i++) { dos.writeUTF(getHashKey().getFieldPath(i)); } } }