예제 #1
0
 public void write(DataOutput out) throws IOException {
   out.write(BASE_TYPE);
   out.writeUTF(name);
   out.writeInt(sampleStrs.size());
   for (int i = 0; i < sampleStrs.size(); i++) {
     UTF8.writeString(out, sampleStrs.get(i));
   }
   out.writeInt(tokenClassIdentifier);
   out.writeBoolean(tokenParameter != null);
   if (tokenParameter != null) {
     UTF8.writeString(out, tokenParameter);
   }
 }
예제 #2
0
 public void readFields(DataInput in) throws IOException {
   // instance-specific
   this.sampleStrs = new ArrayList<String>();
   int numSamples = in.readInt();
   for (int i = 0; i < numSamples; i++) {
     sampleStrs.add(UTF8.readString(in).toString());
   }
   this.tokenClassIdentifier = in.readInt();
   if (in.readBoolean()) {
     this.tokenParameter = UTF8.readString(in);
   } else {
     this.tokenParameter = null;
   }
   this.schema = computeAvroSchema();
 }