001// Automatically generated by the Thrifty compiler; do not edit!
002// Generated on: 2020-06-15T05:54:05.217Z
003// Source: J:\faceapi\faceapi-service\FaceApi.thrift at 83:1
004package net.gdface.sdk.thrift.client;
005
006import com.microsoft.thrifty.TType;
007import com.microsoft.thrifty.ThriftException;
008import com.microsoft.thrifty.protocol.FieldMetadata;
009import com.microsoft.thrifty.protocol.ListMetadata;
010import com.microsoft.thrifty.protocol.MapMetadata;
011import com.microsoft.thrifty.protocol.MessageMetadata;
012import com.microsoft.thrifty.protocol.Protocol;
013import com.microsoft.thrifty.service.AsyncClientBase;
014import com.microsoft.thrifty.service.MethodCall;
015import com.microsoft.thrifty.service.ServiceMethodCallback;
016import com.microsoft.thrifty.service.TMessageType;
017import com.microsoft.thrifty.util.ProtocolUtil;
018import java.io.IOException;
019import java.util.ArrayList;
020import java.util.HashMap;
021import java.util.List;
022import java.util.Map;
023import javax.annotation.Generated;
024import okio.ByteString;
025
026@Generated(
027    value = "com.microsoft.thrifty.gen.ThriftyCodeGenerator",
028    comments = "https://github.com/microsoft/thrifty"
029)
030public class FaceApiClient extends AsyncClientBase implements FaceApi {
031  public FaceApiClient(Protocol protocol, AsyncClientBase.Listener listener) {
032    super(protocol, listener);
033  }
034
035  @Override
036  public void compare2Face(ByteString imgData1, CodeInfo facePos1, ByteString imgData2,
037      CodeInfo facePos2, ServiceMethodCallback<Double> callback) {
038    this.enqueue(new Compare2FaceCall(imgData1, facePos1, imgData2, facePos2, callback));
039  }
040
041  @Override
042  public void compareCode(ByteString code1, ByteString code2,
043      ServiceMethodCallback<Double> callback) {
044    this.enqueue(new CompareCodeCall(code1, code2, callback));
045  }
046
047  @Override
048  public void compareCodes(ByteString code1, List<CodeInfo> codes,
049      ServiceMethodCallback<List<Double>> callback) {
050    this.enqueue(new CompareCodesCall(code1, codes, callback));
051  }
052
053  @Override
054  public void compareFaces(ByteString code, ByteString imgData, Integer faceNum,
055      ServiceMethodCallback<CompareResult> callback) {
056    this.enqueue(new CompareFacesCall(code, imgData, faceNum, callback));
057  }
058
059  @Override
060  public void compareFeatures(ByteString code1, List<ByteString> codes,
061      ServiceMethodCallback<List<Double>> callback) {
062    this.enqueue(new CompareFeaturesCall(code1, codes, callback));
063  }
064
065  @Override
066  public void detectAndCompare2Face(ByteString imgData1, FRect detectRect1, ByteString imgData2,
067      FRect detectRect2, ServiceMethodCallback<Double> callback) {
068    this.enqueue(new DetectAndCompare2FaceCall(imgData1, detectRect1, imgData2, detectRect2, callback));
069  }
070
071  @Override
072  public void detectAndGetCodeInfo(ByteString imgData, Integer faceNum,
073      ServiceMethodCallback<List<CodeInfo>> callback) {
074    this.enqueue(new DetectAndGetCodeInfoCall(imgData, faceNum, callback));
075  }
076
077  @Override
078  public void detectCenterFace(ByteString imgData, ServiceMethodCallback<CodeInfo> callback) {
079    this.enqueue(new DetectCenterFaceCall(imgData, callback));
080  }
081
082  @Override
083  public void detectFace(ByteString imgData, ServiceMethodCallback<List<CodeInfo>> callback) {
084    this.enqueue(new DetectFaceCall(imgData, callback));
085  }
086
087  @Override
088  public void detectMaxFace(ByteString imgData, ServiceMethodCallback<CodeInfo> callback) {
089    this.enqueue(new DetectMaxFaceCall(imgData, callback));
090  }
091
092  @Override
093  public void getCodeInfo(ByteString imgData, Integer faceNum, List<CodeInfo> facePos,
094      ServiceMethodCallback<List<CodeInfo>> callback) {
095    this.enqueue(new GetCodeInfoCall(imgData, faceNum, facePos, callback));
096  }
097
098  @Override
099  public void getCodeInfoSingle(ByteString imgData, CodeInfo facePos,
100      ServiceMethodCallback<CodeInfo> callback) {
101    this.enqueue(new GetCodeInfoSingleCall(imgData, facePos, callback));
102  }
103
104  @Override
105  public void getFeature(Map<ByteString, CodeInfo> faces,
106      ServiceMethodCallback<ByteString> callback) {
107    this.enqueue(new GetFeatureCall(faces, callback));
108  }
109
110  @Override
111  public void hasFace(ByteString imgData, ServiceMethodCallback<Boolean> callback) {
112    this.enqueue(new HasFaceCall(imgData, callback));
113  }
114
115  @Override
116  public void isLocal(ServiceMethodCallback<Boolean> callback) {
117    this.enqueue(new IsLocalCall(callback));
118  }
119
120  @Override
121  public void matDetectAndGetCodeInfo(MatType matType, ByteString matData, Integer width,
122      Integer height, Integer faceNum, ServiceMethodCallback<List<CodeInfo>> callback) {
123    this.enqueue(new MatDetectAndGetCodeInfoCall(matType, matData, width, height, faceNum, callback));
124  }
125
126  @Override
127  public void matDetectFace(MatType matType, ByteString matData, Integer width, Integer height,
128      ServiceMethodCallback<List<CodeInfo>> callback) {
129    this.enqueue(new MatDetectFaceCall(matType, matData, width, height, callback));
130  }
131
132  @Override
133  public void matDetectMaxFace(MatType matType, ByteString matData, Integer width, Integer height,
134      ServiceMethodCallback<CodeInfo> callback) {
135    this.enqueue(new MatDetectMaxFaceCall(matType, matData, width, height, callback));
136  }
137
138  @Override
139  public void matGetCodeInfo(MatType matType, ByteString matData, Integer width, Integer height,
140      Integer facenum, List<CodeInfo> facePos, ServiceMethodCallback<List<CodeInfo>> callback) {
141    this.enqueue(new MatGetCodeInfoCall(matType, matData, width, height, facenum, facePos, callback));
142  }
143
144  @Override
145  public void matGetCodeInfoSingle(MatType matType, ByteString matData, Integer width,
146      Integer height, CodeInfo facePos, ServiceMethodCallback<CodeInfo> callback) {
147    this.enqueue(new MatGetCodeInfoSingleCall(matType, matData, width, height, facePos, callback));
148  }
149
150  @Override
151  public void matHasFace(MatType matType, ByteString matData, Integer width, Integer height,
152      ServiceMethodCallback<Boolean> callback) {
153    this.enqueue(new MatHasFaceCall(matType, matData, width, height, callback));
154  }
155
156  @Override
157  public void matSearchFaces(MatType matType, ByteString matData, Integer width, Integer height,
158      CodeInfo facePos, Double similarty, Integer rows,
159      ServiceMethodCallback<List<FseResult>> callback) {
160    this.enqueue(new MatSearchFacesCall(matType, matData, width, height, facePos, similarty, rows, callback));
161  }
162
163  @Override
164  public void matWearMask(MatType matType, ByteString matData, Integer width, Integer height,
165      CodeInfo faceInfo, ServiceMethodCallback<Boolean> callback) {
166    this.enqueue(new MatWearMaskCall(matType, matData, width, height, faceInfo, callback));
167  }
168
169  @Override
170  public void sdkCapacity(ServiceMethodCallback<Map<String, String>> callback) {
171    this.enqueue(new SdkCapacityCall(callback));
172  }
173
174  @Override
175  public void searchFaces(ByteString imgData, CodeInfo facePos, Double similarty, Integer rows,
176      ServiceMethodCallback<List<FseResult>> callback) {
177    this.enqueue(new SearchFacesCall(imgData, facePos, similarty, rows, callback));
178  }
179
180  @Override
181  public void searchFeatures(ByteString feature, Double similarty, Integer rows,
182      ServiceMethodCallback<List<FseResult>> callback) {
183    this.enqueue(new SearchFeaturesCall(feature, similarty, rows, callback));
184  }
185
186  @Override
187  public void wearMask(ByteString imgData, CodeInfo faceInfo,
188      ServiceMethodCallback<Boolean> callback) {
189    this.enqueue(new WearMaskCall(imgData, faceInfo, callback));
190  }
191
192  private static final class Compare2FaceCall extends MethodCall<Double> {
193    private final ByteString imgData1;
194
195    private final CodeInfo facePos1;
196
197    private final ByteString imgData2;
198
199    private final CodeInfo facePos2;
200
201    Compare2FaceCall(ByteString imgData1, CodeInfo facePos1, ByteString imgData2, CodeInfo facePos2,
202        ServiceMethodCallback<Double> callback) {
203      super("compare2Face", TMessageType.CALL, callback);
204      this.imgData1 = imgData1;
205      this.facePos1 = facePos1;
206      this.imgData2 = imgData2;
207      this.facePos2 = facePos2;
208    }
209
210    @Override
211    protected void send(Protocol protocol) throws IOException {
212      protocol.writeStructBegin("args");
213      if (this.imgData1 != null) {
214        protocol.writeFieldBegin("imgData1", 1, TType.STRING);
215        protocol.writeBinary(this.imgData1);
216        protocol.writeFieldEnd();
217      }
218      if (this.facePos1 != null) {
219        protocol.writeFieldBegin("facePos1", 2, TType.STRUCT);
220        net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.write(protocol, this.facePos1);
221        protocol.writeFieldEnd();
222      }
223      if (this.imgData2 != null) {
224        protocol.writeFieldBegin("imgData2", 3, TType.STRING);
225        protocol.writeBinary(this.imgData2);
226        protocol.writeFieldEnd();
227      }
228      if (this.facePos2 != null) {
229        protocol.writeFieldBegin("facePos2", 4, TType.STRUCT);
230        net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.write(protocol, this.facePos2);
231        protocol.writeFieldEnd();
232      }
233      protocol.writeFieldStop();
234      protocol.writeStructEnd();
235    }
236
237    @Override
238    protected Double receive(Protocol protocol, MessageMetadata metadata) throws Exception {
239      Double result = null;
240      ImageErrorException ex1 = null;
241      NotFaceDetectedException ex2 = null;
242      ServiceRuntimeException ex3 = null;
243      protocol.readStructBegin();
244      while (true) {
245        FieldMetadata field = protocol.readFieldBegin();
246        if (field.typeId == TType.STOP) {
247          break;
248        }
249        switch (field.fieldId) {
250          case 0: {
251            if (field.typeId == TType.DOUBLE) {
252              double value = protocol.readDouble();
253              result = value;
254            } else {
255              ProtocolUtil.skip(protocol, field.typeId);
256            }
257          }
258          break;
259          case 1: {
260            if (field.typeId == TType.STRUCT) {
261              net.gdface.sdk.thrift.client.ImageErrorException value = net.gdface.sdk.thrift.client.ImageErrorException.ADAPTER.read(protocol);
262              ex1 = value;
263            } else {
264              ProtocolUtil.skip(protocol, field.typeId);
265            }
266          }
267          break;
268          case 2: {
269            if (field.typeId == TType.STRUCT) {
270              net.gdface.sdk.thrift.client.NotFaceDetectedException value = net.gdface.sdk.thrift.client.NotFaceDetectedException.ADAPTER.read(protocol);
271              ex2 = value;
272            } else {
273              ProtocolUtil.skip(protocol, field.typeId);
274            }
275          }
276          break;
277          case 3: {
278            if (field.typeId == TType.STRUCT) {
279              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
280              ex3 = value;
281            } else {
282              ProtocolUtil.skip(protocol, field.typeId);
283            }
284          }
285          break;
286          default: ProtocolUtil.skip(protocol, field.typeId); break;
287        }
288        protocol.readFieldEnd();
289      }
290      protocol.readStructEnd();
291      if (result != null) {
292        return result;
293      } else if (ex1 != null) {
294        throw ex1;
295      } else if (ex2 != null) {
296        throw ex2;
297      } else if (ex3 != null) {
298        throw ex3;
299      } else {
300        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
301      }
302    }
303  }
304
305  private static final class CompareCodeCall extends MethodCall<Double> {
306    private final ByteString code1;
307
308    private final ByteString code2;
309
310    CompareCodeCall(ByteString code1, ByteString code2, ServiceMethodCallback<Double> callback) {
311      super("compareCode", TMessageType.CALL, callback);
312      this.code1 = code1;
313      this.code2 = code2;
314    }
315
316    @Override
317    protected void send(Protocol protocol) throws IOException {
318      protocol.writeStructBegin("args");
319      if (this.code1 != null) {
320        protocol.writeFieldBegin("code1", 1, TType.STRING);
321        protocol.writeBinary(this.code1);
322        protocol.writeFieldEnd();
323      }
324      if (this.code2 != null) {
325        protocol.writeFieldBegin("code2", 2, TType.STRING);
326        protocol.writeBinary(this.code2);
327        protocol.writeFieldEnd();
328      }
329      protocol.writeFieldStop();
330      protocol.writeStructEnd();
331    }
332
333    @Override
334    protected Double receive(Protocol protocol, MessageMetadata metadata) throws Exception {
335      Double result = null;
336      ServiceRuntimeException ex1 = null;
337      protocol.readStructBegin();
338      while (true) {
339        FieldMetadata field = protocol.readFieldBegin();
340        if (field.typeId == TType.STOP) {
341          break;
342        }
343        switch (field.fieldId) {
344          case 0: {
345            if (field.typeId == TType.DOUBLE) {
346              double value = protocol.readDouble();
347              result = value;
348            } else {
349              ProtocolUtil.skip(protocol, field.typeId);
350            }
351          }
352          break;
353          case 1: {
354            if (field.typeId == TType.STRUCT) {
355              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
356              ex1 = value;
357            } else {
358              ProtocolUtil.skip(protocol, field.typeId);
359            }
360          }
361          break;
362          default: ProtocolUtil.skip(protocol, field.typeId); break;
363        }
364        protocol.readFieldEnd();
365      }
366      protocol.readStructEnd();
367      if (result != null) {
368        return result;
369      } else if (ex1 != null) {
370        throw ex1;
371      } else {
372        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
373      }
374    }
375  }
376
377  private static final class CompareCodesCall extends MethodCall<List<Double>> {
378    private final ByteString code1;
379
380    private final List<CodeInfo> codes;
381
382    CompareCodesCall(ByteString code1, List<CodeInfo> codes,
383        ServiceMethodCallback<List<Double>> callback) {
384      super("compareCodes", TMessageType.CALL, callback);
385      this.code1 = code1;
386      this.codes = codes;
387    }
388
389    @Override
390    protected void send(Protocol protocol) throws IOException {
391      protocol.writeStructBegin("args");
392      if (this.code1 != null) {
393        protocol.writeFieldBegin("code1", 1, TType.STRING);
394        protocol.writeBinary(this.code1);
395        protocol.writeFieldEnd();
396      }
397      if (this.codes != null) {
398        protocol.writeFieldBegin("codes", 2, TType.LIST);
399        protocol.writeListBegin(TType.STRUCT, this.codes.size());
400        for (CodeInfo item0 : this.codes) {
401          net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.write(protocol, item0);
402        }
403        protocol.writeListEnd();
404        protocol.writeFieldEnd();
405      }
406      protocol.writeFieldStop();
407      protocol.writeStructEnd();
408    }
409
410    @Override
411    protected List<Double> receive(Protocol protocol, MessageMetadata metadata) throws Exception {
412      List<Double> result = null;
413      ServiceRuntimeException ex1 = null;
414      protocol.readStructBegin();
415      while (true) {
416        FieldMetadata field = protocol.readFieldBegin();
417        if (field.typeId == TType.STOP) {
418          break;
419        }
420        switch (field.fieldId) {
421          case 0: {
422            if (field.typeId == TType.LIST) {
423              ListMetadata listMetadata0 = protocol.readListBegin();
424              List<Double> value = new ArrayList<Double>(listMetadata0.size);
425              for (int i0 = 0; i0 < listMetadata0.size; ++i0) {
426                double item0 = protocol.readDouble();
427                value.add(item0);
428              }
429              protocol.readListEnd();
430              result = value;
431            } else {
432              ProtocolUtil.skip(protocol, field.typeId);
433            }
434          }
435          break;
436          case 1: {
437            if (field.typeId == TType.STRUCT) {
438              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
439              ex1 = value;
440            } else {
441              ProtocolUtil.skip(protocol, field.typeId);
442            }
443          }
444          break;
445          default: ProtocolUtil.skip(protocol, field.typeId); break;
446        }
447        protocol.readFieldEnd();
448      }
449      protocol.readStructEnd();
450      if (result != null) {
451        return result;
452      } else if (ex1 != null) {
453        throw ex1;
454      } else {
455        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
456      }
457    }
458  }
459
460  private static final class CompareFacesCall extends MethodCall<CompareResult> {
461    private final ByteString code;
462
463    private final ByteString imgData;
464
465    private final Integer faceNum;
466
467    CompareFacesCall(ByteString code, ByteString imgData, Integer faceNum,
468        ServiceMethodCallback<CompareResult> callback) {
469      super("compareFaces", TMessageType.CALL, callback);
470      this.code = code;
471      this.imgData = imgData;
472      if (faceNum == null) throw new NullPointerException("faceNum");
473      this.faceNum = faceNum;
474    }
475
476    @Override
477    protected void send(Protocol protocol) throws IOException {
478      protocol.writeStructBegin("args");
479      if (this.code != null) {
480        protocol.writeFieldBegin("code", 1, TType.STRING);
481        protocol.writeBinary(this.code);
482        protocol.writeFieldEnd();
483      }
484      if (this.imgData != null) {
485        protocol.writeFieldBegin("imgData", 2, TType.STRING);
486        protocol.writeBinary(this.imgData);
487        protocol.writeFieldEnd();
488      }
489      protocol.writeFieldBegin("faceNum", 3, TType.I32);
490      protocol.writeI32(this.faceNum);
491      protocol.writeFieldEnd();
492      protocol.writeFieldStop();
493      protocol.writeStructEnd();
494    }
495
496    @Override
497    protected CompareResult receive(Protocol protocol, MessageMetadata metadata) throws Exception {
498      CompareResult result = null;
499      ImageErrorException ex1 = null;
500      NotFaceDetectedException ex2 = null;
501      ServiceRuntimeException ex3 = null;
502      protocol.readStructBegin();
503      while (true) {
504        FieldMetadata field = protocol.readFieldBegin();
505        if (field.typeId == TType.STOP) {
506          break;
507        }
508        switch (field.fieldId) {
509          case 0: {
510            if (field.typeId == TType.STRUCT) {
511              net.gdface.sdk.thrift.client.CompareResult value = net.gdface.sdk.thrift.client.CompareResult.ADAPTER.read(protocol);
512              result = value;
513            } else {
514              ProtocolUtil.skip(protocol, field.typeId);
515            }
516          }
517          break;
518          case 1: {
519            if (field.typeId == TType.STRUCT) {
520              net.gdface.sdk.thrift.client.ImageErrorException value = net.gdface.sdk.thrift.client.ImageErrorException.ADAPTER.read(protocol);
521              ex1 = value;
522            } else {
523              ProtocolUtil.skip(protocol, field.typeId);
524            }
525          }
526          break;
527          case 2: {
528            if (field.typeId == TType.STRUCT) {
529              net.gdface.sdk.thrift.client.NotFaceDetectedException value = net.gdface.sdk.thrift.client.NotFaceDetectedException.ADAPTER.read(protocol);
530              ex2 = value;
531            } else {
532              ProtocolUtil.skip(protocol, field.typeId);
533            }
534          }
535          break;
536          case 3: {
537            if (field.typeId == TType.STRUCT) {
538              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
539              ex3 = value;
540            } else {
541              ProtocolUtil.skip(protocol, field.typeId);
542            }
543          }
544          break;
545          default: ProtocolUtil.skip(protocol, field.typeId); break;
546        }
547        protocol.readFieldEnd();
548      }
549      protocol.readStructEnd();
550      if (result != null) {
551        return result;
552      } else if (ex1 != null) {
553        throw ex1;
554      } else if (ex2 != null) {
555        throw ex2;
556      } else if (ex3 != null) {
557        throw ex3;
558      } else {
559        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
560      }
561    }
562  }
563
564  private static final class CompareFeaturesCall extends MethodCall<List<Double>> {
565    private final ByteString code1;
566
567    private final List<ByteString> codes;
568
569    CompareFeaturesCall(ByteString code1, List<ByteString> codes,
570        ServiceMethodCallback<List<Double>> callback) {
571      super("compareFeatures", TMessageType.CALL, callback);
572      this.code1 = code1;
573      this.codes = codes;
574    }
575
576    @Override
577    protected void send(Protocol protocol) throws IOException {
578      protocol.writeStructBegin("args");
579      if (this.code1 != null) {
580        protocol.writeFieldBegin("code1", 1, TType.STRING);
581        protocol.writeBinary(this.code1);
582        protocol.writeFieldEnd();
583      }
584      if (this.codes != null) {
585        protocol.writeFieldBegin("codes", 2, TType.LIST);
586        protocol.writeListBegin(TType.STRING, this.codes.size());
587        for (ByteString item0 : this.codes) {
588          protocol.writeBinary(item0);
589        }
590        protocol.writeListEnd();
591        protocol.writeFieldEnd();
592      }
593      protocol.writeFieldStop();
594      protocol.writeStructEnd();
595    }
596
597    @Override
598    protected List<Double> receive(Protocol protocol, MessageMetadata metadata) throws Exception {
599      List<Double> result = null;
600      ServiceRuntimeException ex1 = null;
601      protocol.readStructBegin();
602      while (true) {
603        FieldMetadata field = protocol.readFieldBegin();
604        if (field.typeId == TType.STOP) {
605          break;
606        }
607        switch (field.fieldId) {
608          case 0: {
609            if (field.typeId == TType.LIST) {
610              ListMetadata listMetadata0 = protocol.readListBegin();
611              List<Double> value = new ArrayList<Double>(listMetadata0.size);
612              for (int i0 = 0; i0 < listMetadata0.size; ++i0) {
613                double item0 = protocol.readDouble();
614                value.add(item0);
615              }
616              protocol.readListEnd();
617              result = value;
618            } else {
619              ProtocolUtil.skip(protocol, field.typeId);
620            }
621          }
622          break;
623          case 1: {
624            if (field.typeId == TType.STRUCT) {
625              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
626              ex1 = value;
627            } else {
628              ProtocolUtil.skip(protocol, field.typeId);
629            }
630          }
631          break;
632          default: ProtocolUtil.skip(protocol, field.typeId); break;
633        }
634        protocol.readFieldEnd();
635      }
636      protocol.readStructEnd();
637      if (result != null) {
638        return result;
639      } else if (ex1 != null) {
640        throw ex1;
641      } else {
642        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
643      }
644    }
645  }
646
647  private static final class DetectAndCompare2FaceCall extends MethodCall<Double> {
648    private final ByteString imgData1;
649
650    private final FRect detectRect1;
651
652    private final ByteString imgData2;
653
654    private final FRect detectRect2;
655
656    DetectAndCompare2FaceCall(ByteString imgData1, FRect detectRect1, ByteString imgData2,
657        FRect detectRect2, ServiceMethodCallback<Double> callback) {
658      super("detectAndCompare2Face", TMessageType.CALL, callback);
659      this.imgData1 = imgData1;
660      this.detectRect1 = detectRect1;
661      this.imgData2 = imgData2;
662      this.detectRect2 = detectRect2;
663    }
664
665    @Override
666    protected void send(Protocol protocol) throws IOException {
667      protocol.writeStructBegin("args");
668      if (this.imgData1 != null) {
669        protocol.writeFieldBegin("imgData1", 1, TType.STRING);
670        protocol.writeBinary(this.imgData1);
671        protocol.writeFieldEnd();
672      }
673      if (this.detectRect1 != null) {
674        protocol.writeFieldBegin("detectRect1", 2, TType.STRUCT);
675        net.gdface.sdk.thrift.client.FRect.ADAPTER.write(protocol, this.detectRect1);
676        protocol.writeFieldEnd();
677      }
678      if (this.imgData2 != null) {
679        protocol.writeFieldBegin("imgData2", 3, TType.STRING);
680        protocol.writeBinary(this.imgData2);
681        protocol.writeFieldEnd();
682      }
683      if (this.detectRect2 != null) {
684        protocol.writeFieldBegin("detectRect2", 4, TType.STRUCT);
685        net.gdface.sdk.thrift.client.FRect.ADAPTER.write(protocol, this.detectRect2);
686        protocol.writeFieldEnd();
687      }
688      protocol.writeFieldStop();
689      protocol.writeStructEnd();
690    }
691
692    @Override
693    protected Double receive(Protocol protocol, MessageMetadata metadata) throws Exception {
694      Double result = null;
695      ImageErrorException ex1 = null;
696      NotFaceDetectedException ex2 = null;
697      ServiceRuntimeException ex3 = null;
698      protocol.readStructBegin();
699      while (true) {
700        FieldMetadata field = protocol.readFieldBegin();
701        if (field.typeId == TType.STOP) {
702          break;
703        }
704        switch (field.fieldId) {
705          case 0: {
706            if (field.typeId == TType.DOUBLE) {
707              double value = protocol.readDouble();
708              result = value;
709            } else {
710              ProtocolUtil.skip(protocol, field.typeId);
711            }
712          }
713          break;
714          case 1: {
715            if (field.typeId == TType.STRUCT) {
716              net.gdface.sdk.thrift.client.ImageErrorException value = net.gdface.sdk.thrift.client.ImageErrorException.ADAPTER.read(protocol);
717              ex1 = value;
718            } else {
719              ProtocolUtil.skip(protocol, field.typeId);
720            }
721          }
722          break;
723          case 2: {
724            if (field.typeId == TType.STRUCT) {
725              net.gdface.sdk.thrift.client.NotFaceDetectedException value = net.gdface.sdk.thrift.client.NotFaceDetectedException.ADAPTER.read(protocol);
726              ex2 = value;
727            } else {
728              ProtocolUtil.skip(protocol, field.typeId);
729            }
730          }
731          break;
732          case 3: {
733            if (field.typeId == TType.STRUCT) {
734              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
735              ex3 = value;
736            } else {
737              ProtocolUtil.skip(protocol, field.typeId);
738            }
739          }
740          break;
741          default: ProtocolUtil.skip(protocol, field.typeId); break;
742        }
743        protocol.readFieldEnd();
744      }
745      protocol.readStructEnd();
746      if (result != null) {
747        return result;
748      } else if (ex1 != null) {
749        throw ex1;
750      } else if (ex2 != null) {
751        throw ex2;
752      } else if (ex3 != null) {
753        throw ex3;
754      } else {
755        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
756      }
757    }
758  }
759
760  private static final class DetectAndGetCodeInfoCall extends MethodCall<List<CodeInfo>> {
761    private final ByteString imgData;
762
763    private final Integer faceNum;
764
765    DetectAndGetCodeInfoCall(ByteString imgData, Integer faceNum,
766        ServiceMethodCallback<List<CodeInfo>> callback) {
767      super("detectAndGetCodeInfo", TMessageType.CALL, callback);
768      this.imgData = imgData;
769      if (faceNum == null) throw new NullPointerException("faceNum");
770      this.faceNum = faceNum;
771    }
772
773    @Override
774    protected void send(Protocol protocol) throws IOException {
775      protocol.writeStructBegin("args");
776      if (this.imgData != null) {
777        protocol.writeFieldBegin("imgData", 1, TType.STRING);
778        protocol.writeBinary(this.imgData);
779        protocol.writeFieldEnd();
780      }
781      protocol.writeFieldBegin("faceNum", 2, TType.I32);
782      protocol.writeI32(this.faceNum);
783      protocol.writeFieldEnd();
784      protocol.writeFieldStop();
785      protocol.writeStructEnd();
786    }
787
788    @Override
789    protected List<CodeInfo> receive(Protocol protocol, MessageMetadata metadata) throws Exception {
790      List<CodeInfo> result = null;
791      ImageErrorException ex1 = null;
792      NotFaceDetectedException ex2 = null;
793      ServiceRuntimeException ex3 = null;
794      protocol.readStructBegin();
795      while (true) {
796        FieldMetadata field = protocol.readFieldBegin();
797        if (field.typeId == TType.STOP) {
798          break;
799        }
800        switch (field.fieldId) {
801          case 0: {
802            if (field.typeId == TType.LIST) {
803              ListMetadata listMetadata0 = protocol.readListBegin();
804              List<CodeInfo> value = new ArrayList<CodeInfo>(listMetadata0.size);
805              for (int i0 = 0; i0 < listMetadata0.size; ++i0) {
806                net.gdface.sdk.thrift.client.CodeInfo item0 = net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.read(protocol);
807                value.add(item0);
808              }
809              protocol.readListEnd();
810              result = value;
811            } else {
812              ProtocolUtil.skip(protocol, field.typeId);
813            }
814          }
815          break;
816          case 1: {
817            if (field.typeId == TType.STRUCT) {
818              net.gdface.sdk.thrift.client.ImageErrorException value = net.gdface.sdk.thrift.client.ImageErrorException.ADAPTER.read(protocol);
819              ex1 = value;
820            } else {
821              ProtocolUtil.skip(protocol, field.typeId);
822            }
823          }
824          break;
825          case 2: {
826            if (field.typeId == TType.STRUCT) {
827              net.gdface.sdk.thrift.client.NotFaceDetectedException value = net.gdface.sdk.thrift.client.NotFaceDetectedException.ADAPTER.read(protocol);
828              ex2 = value;
829            } else {
830              ProtocolUtil.skip(protocol, field.typeId);
831            }
832          }
833          break;
834          case 3: {
835            if (field.typeId == TType.STRUCT) {
836              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
837              ex3 = value;
838            } else {
839              ProtocolUtil.skip(protocol, field.typeId);
840            }
841          }
842          break;
843          default: ProtocolUtil.skip(protocol, field.typeId); break;
844        }
845        protocol.readFieldEnd();
846      }
847      protocol.readStructEnd();
848      if (result != null) {
849        return result;
850      } else if (ex1 != null) {
851        throw ex1;
852      } else if (ex2 != null) {
853        throw ex2;
854      } else if (ex3 != null) {
855        throw ex3;
856      } else {
857        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
858      }
859    }
860  }
861
862  private static final class DetectCenterFaceCall extends MethodCall<CodeInfo> {
863    private final ByteString imgData;
864
865    DetectCenterFaceCall(ByteString imgData, ServiceMethodCallback<CodeInfo> callback) {
866      super("detectCenterFace", TMessageType.CALL, callback);
867      this.imgData = imgData;
868    }
869
870    @Override
871    protected void send(Protocol protocol) throws IOException {
872      protocol.writeStructBegin("args");
873      if (this.imgData != null) {
874        protocol.writeFieldBegin("imgData", 1, TType.STRING);
875        protocol.writeBinary(this.imgData);
876        protocol.writeFieldEnd();
877      }
878      protocol.writeFieldStop();
879      protocol.writeStructEnd();
880    }
881
882    @Override
883    protected CodeInfo receive(Protocol protocol, MessageMetadata metadata) throws Exception {
884      CodeInfo result = null;
885      ImageErrorException ex1 = null;
886      NotFaceDetectedException ex2 = null;
887      ServiceRuntimeException ex3 = null;
888      protocol.readStructBegin();
889      while (true) {
890        FieldMetadata field = protocol.readFieldBegin();
891        if (field.typeId == TType.STOP) {
892          break;
893        }
894        switch (field.fieldId) {
895          case 0: {
896            if (field.typeId == TType.STRUCT) {
897              net.gdface.sdk.thrift.client.CodeInfo value = net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.read(protocol);
898              result = value;
899            } else {
900              ProtocolUtil.skip(protocol, field.typeId);
901            }
902          }
903          break;
904          case 1: {
905            if (field.typeId == TType.STRUCT) {
906              net.gdface.sdk.thrift.client.ImageErrorException value = net.gdface.sdk.thrift.client.ImageErrorException.ADAPTER.read(protocol);
907              ex1 = value;
908            } else {
909              ProtocolUtil.skip(protocol, field.typeId);
910            }
911          }
912          break;
913          case 2: {
914            if (field.typeId == TType.STRUCT) {
915              net.gdface.sdk.thrift.client.NotFaceDetectedException value = net.gdface.sdk.thrift.client.NotFaceDetectedException.ADAPTER.read(protocol);
916              ex2 = value;
917            } else {
918              ProtocolUtil.skip(protocol, field.typeId);
919            }
920          }
921          break;
922          case 3: {
923            if (field.typeId == TType.STRUCT) {
924              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
925              ex3 = value;
926            } else {
927              ProtocolUtil.skip(protocol, field.typeId);
928            }
929          }
930          break;
931          default: ProtocolUtil.skip(protocol, field.typeId); break;
932        }
933        protocol.readFieldEnd();
934      }
935      protocol.readStructEnd();
936      if (result != null) {
937        return result;
938      } else if (ex1 != null) {
939        throw ex1;
940      } else if (ex2 != null) {
941        throw ex2;
942      } else if (ex3 != null) {
943        throw ex3;
944      } else {
945        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
946      }
947    }
948  }
949
950  private static final class DetectFaceCall extends MethodCall<List<CodeInfo>> {
951    private final ByteString imgData;
952
953    DetectFaceCall(ByteString imgData, ServiceMethodCallback<List<CodeInfo>> callback) {
954      super("detectFace", TMessageType.CALL, callback);
955      this.imgData = imgData;
956    }
957
958    @Override
959    protected void send(Protocol protocol) throws IOException {
960      protocol.writeStructBegin("args");
961      if (this.imgData != null) {
962        protocol.writeFieldBegin("imgData", 1, TType.STRING);
963        protocol.writeBinary(this.imgData);
964        protocol.writeFieldEnd();
965      }
966      protocol.writeFieldStop();
967      protocol.writeStructEnd();
968    }
969
970    @Override
971    protected List<CodeInfo> receive(Protocol protocol, MessageMetadata metadata) throws Exception {
972      List<CodeInfo> result = null;
973      ImageErrorException ex1 = null;
974      ServiceRuntimeException ex2 = null;
975      protocol.readStructBegin();
976      while (true) {
977        FieldMetadata field = protocol.readFieldBegin();
978        if (field.typeId == TType.STOP) {
979          break;
980        }
981        switch (field.fieldId) {
982          case 0: {
983            if (field.typeId == TType.LIST) {
984              ListMetadata listMetadata0 = protocol.readListBegin();
985              List<CodeInfo> value = new ArrayList<CodeInfo>(listMetadata0.size);
986              for (int i0 = 0; i0 < listMetadata0.size; ++i0) {
987                net.gdface.sdk.thrift.client.CodeInfo item0 = net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.read(protocol);
988                value.add(item0);
989              }
990              protocol.readListEnd();
991              result = value;
992            } else {
993              ProtocolUtil.skip(protocol, field.typeId);
994            }
995          }
996          break;
997          case 1: {
998            if (field.typeId == TType.STRUCT) {
999              net.gdface.sdk.thrift.client.ImageErrorException value = net.gdface.sdk.thrift.client.ImageErrorException.ADAPTER.read(protocol);
1000              ex1 = value;
1001            } else {
1002              ProtocolUtil.skip(protocol, field.typeId);
1003            }
1004          }
1005          break;
1006          case 2: {
1007            if (field.typeId == TType.STRUCT) {
1008              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
1009              ex2 = value;
1010            } else {
1011              ProtocolUtil.skip(protocol, field.typeId);
1012            }
1013          }
1014          break;
1015          default: ProtocolUtil.skip(protocol, field.typeId); break;
1016        }
1017        protocol.readFieldEnd();
1018      }
1019      protocol.readStructEnd();
1020      if (result != null) {
1021        return result;
1022      } else if (ex1 != null) {
1023        throw ex1;
1024      } else if (ex2 != null) {
1025        throw ex2;
1026      } else {
1027        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
1028      }
1029    }
1030  }
1031
1032  private static final class DetectMaxFaceCall extends MethodCall<CodeInfo> {
1033    private final ByteString imgData;
1034
1035    DetectMaxFaceCall(ByteString imgData, ServiceMethodCallback<CodeInfo> callback) {
1036      super("detectMaxFace", TMessageType.CALL, callback);
1037      this.imgData = imgData;
1038    }
1039
1040    @Override
1041    protected void send(Protocol protocol) throws IOException {
1042      protocol.writeStructBegin("args");
1043      if (this.imgData != null) {
1044        protocol.writeFieldBegin("imgData", 1, TType.STRING);
1045        protocol.writeBinary(this.imgData);
1046        protocol.writeFieldEnd();
1047      }
1048      protocol.writeFieldStop();
1049      protocol.writeStructEnd();
1050    }
1051
1052    @Override
1053    protected CodeInfo receive(Protocol protocol, MessageMetadata metadata) throws Exception {
1054      CodeInfo result = null;
1055      ImageErrorException ex1 = null;
1056      NotFaceDetectedException ex2 = null;
1057      ServiceRuntimeException ex3 = null;
1058      protocol.readStructBegin();
1059      while (true) {
1060        FieldMetadata field = protocol.readFieldBegin();
1061        if (field.typeId == TType.STOP) {
1062          break;
1063        }
1064        switch (field.fieldId) {
1065          case 0: {
1066            if (field.typeId == TType.STRUCT) {
1067              net.gdface.sdk.thrift.client.CodeInfo value = net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.read(protocol);
1068              result = value;
1069            } else {
1070              ProtocolUtil.skip(protocol, field.typeId);
1071            }
1072          }
1073          break;
1074          case 1: {
1075            if (field.typeId == TType.STRUCT) {
1076              net.gdface.sdk.thrift.client.ImageErrorException value = net.gdface.sdk.thrift.client.ImageErrorException.ADAPTER.read(protocol);
1077              ex1 = value;
1078            } else {
1079              ProtocolUtil.skip(protocol, field.typeId);
1080            }
1081          }
1082          break;
1083          case 2: {
1084            if (field.typeId == TType.STRUCT) {
1085              net.gdface.sdk.thrift.client.NotFaceDetectedException value = net.gdface.sdk.thrift.client.NotFaceDetectedException.ADAPTER.read(protocol);
1086              ex2 = value;
1087            } else {
1088              ProtocolUtil.skip(protocol, field.typeId);
1089            }
1090          }
1091          break;
1092          case 3: {
1093            if (field.typeId == TType.STRUCT) {
1094              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
1095              ex3 = value;
1096            } else {
1097              ProtocolUtil.skip(protocol, field.typeId);
1098            }
1099          }
1100          break;
1101          default: ProtocolUtil.skip(protocol, field.typeId); break;
1102        }
1103        protocol.readFieldEnd();
1104      }
1105      protocol.readStructEnd();
1106      if (result != null) {
1107        return result;
1108      } else if (ex1 != null) {
1109        throw ex1;
1110      } else if (ex2 != null) {
1111        throw ex2;
1112      } else if (ex3 != null) {
1113        throw ex3;
1114      } else {
1115        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
1116      }
1117    }
1118  }
1119
1120  private static final class GetCodeInfoCall extends MethodCall<List<CodeInfo>> {
1121    private final ByteString imgData;
1122
1123    private final Integer faceNum;
1124
1125    private final List<CodeInfo> facePos;
1126
1127    GetCodeInfoCall(ByteString imgData, Integer faceNum, List<CodeInfo> facePos,
1128        ServiceMethodCallback<List<CodeInfo>> callback) {
1129      super("getCodeInfo", TMessageType.CALL, callback);
1130      this.imgData = imgData;
1131      if (faceNum == null) throw new NullPointerException("faceNum");
1132      this.faceNum = faceNum;
1133      this.facePos = facePos;
1134    }
1135
1136    @Override
1137    protected void send(Protocol protocol) throws IOException {
1138      protocol.writeStructBegin("args");
1139      if (this.imgData != null) {
1140        protocol.writeFieldBegin("imgData", 1, TType.STRING);
1141        protocol.writeBinary(this.imgData);
1142        protocol.writeFieldEnd();
1143      }
1144      protocol.writeFieldBegin("faceNum", 2, TType.I32);
1145      protocol.writeI32(this.faceNum);
1146      protocol.writeFieldEnd();
1147      if (this.facePos != null) {
1148        protocol.writeFieldBegin("facePos", 3, TType.LIST);
1149        protocol.writeListBegin(TType.STRUCT, this.facePos.size());
1150        for (CodeInfo item0 : this.facePos) {
1151          net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.write(protocol, item0);
1152        }
1153        protocol.writeListEnd();
1154        protocol.writeFieldEnd();
1155      }
1156      protocol.writeFieldStop();
1157      protocol.writeStructEnd();
1158    }
1159
1160    @Override
1161    protected List<CodeInfo> receive(Protocol protocol, MessageMetadata metadata) throws Exception {
1162      List<CodeInfo> result = null;
1163      NotFaceDetectedException ex1 = null;
1164      ServiceRuntimeException ex2 = null;
1165      protocol.readStructBegin();
1166      while (true) {
1167        FieldMetadata field = protocol.readFieldBegin();
1168        if (field.typeId == TType.STOP) {
1169          break;
1170        }
1171        switch (field.fieldId) {
1172          case 0: {
1173            if (field.typeId == TType.LIST) {
1174              ListMetadata listMetadata0 = protocol.readListBegin();
1175              List<CodeInfo> value = new ArrayList<CodeInfo>(listMetadata0.size);
1176              for (int i0 = 0; i0 < listMetadata0.size; ++i0) {
1177                net.gdface.sdk.thrift.client.CodeInfo item0 = net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.read(protocol);
1178                value.add(item0);
1179              }
1180              protocol.readListEnd();
1181              result = value;
1182            } else {
1183              ProtocolUtil.skip(protocol, field.typeId);
1184            }
1185          }
1186          break;
1187          case 1: {
1188            if (field.typeId == TType.STRUCT) {
1189              net.gdface.sdk.thrift.client.NotFaceDetectedException value = net.gdface.sdk.thrift.client.NotFaceDetectedException.ADAPTER.read(protocol);
1190              ex1 = value;
1191            } else {
1192              ProtocolUtil.skip(protocol, field.typeId);
1193            }
1194          }
1195          break;
1196          case 2: {
1197            if (field.typeId == TType.STRUCT) {
1198              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
1199              ex2 = value;
1200            } else {
1201              ProtocolUtil.skip(protocol, field.typeId);
1202            }
1203          }
1204          break;
1205          default: ProtocolUtil.skip(protocol, field.typeId); break;
1206        }
1207        protocol.readFieldEnd();
1208      }
1209      protocol.readStructEnd();
1210      if (result != null) {
1211        return result;
1212      } else if (ex1 != null) {
1213        throw ex1;
1214      } else if (ex2 != null) {
1215        throw ex2;
1216      } else {
1217        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
1218      }
1219    }
1220  }
1221
1222  private static final class GetCodeInfoSingleCall extends MethodCall<CodeInfo> {
1223    private final ByteString imgData;
1224
1225    private final CodeInfo facePos;
1226
1227    GetCodeInfoSingleCall(ByteString imgData, CodeInfo facePos,
1228        ServiceMethodCallback<CodeInfo> callback) {
1229      super("getCodeInfoSingle", TMessageType.CALL, callback);
1230      this.imgData = imgData;
1231      this.facePos = facePos;
1232    }
1233
1234    @Override
1235    protected void send(Protocol protocol) throws IOException {
1236      protocol.writeStructBegin("args");
1237      if (this.imgData != null) {
1238        protocol.writeFieldBegin("imgData", 1, TType.STRING);
1239        protocol.writeBinary(this.imgData);
1240        protocol.writeFieldEnd();
1241      }
1242      if (this.facePos != null) {
1243        protocol.writeFieldBegin("facePos", 2, TType.STRUCT);
1244        net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.write(protocol, this.facePos);
1245        protocol.writeFieldEnd();
1246      }
1247      protocol.writeFieldStop();
1248      protocol.writeStructEnd();
1249    }
1250
1251    @Override
1252    protected CodeInfo receive(Protocol protocol, MessageMetadata metadata) throws Exception {
1253      CodeInfo result = null;
1254      ServiceRuntimeException ex1 = null;
1255      protocol.readStructBegin();
1256      while (true) {
1257        FieldMetadata field = protocol.readFieldBegin();
1258        if (field.typeId == TType.STOP) {
1259          break;
1260        }
1261        switch (field.fieldId) {
1262          case 0: {
1263            if (field.typeId == TType.STRUCT) {
1264              net.gdface.sdk.thrift.client.CodeInfo value = net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.read(protocol);
1265              result = value;
1266            } else {
1267              ProtocolUtil.skip(protocol, field.typeId);
1268            }
1269          }
1270          break;
1271          case 1: {
1272            if (field.typeId == TType.STRUCT) {
1273              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
1274              ex1 = value;
1275            } else {
1276              ProtocolUtil.skip(protocol, field.typeId);
1277            }
1278          }
1279          break;
1280          default: ProtocolUtil.skip(protocol, field.typeId); break;
1281        }
1282        protocol.readFieldEnd();
1283      }
1284      protocol.readStructEnd();
1285      if (result != null) {
1286        return result;
1287      } else if (ex1 != null) {
1288        throw ex1;
1289      } else {
1290        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
1291      }
1292    }
1293  }
1294
1295  private static final class GetFeatureCall extends MethodCall<ByteString> {
1296    private final Map<ByteString, CodeInfo> faces;
1297
1298    GetFeatureCall(Map<ByteString, CodeInfo> faces, ServiceMethodCallback<ByteString> callback) {
1299      super("getFeature", TMessageType.CALL, callback);
1300      this.faces = faces;
1301    }
1302
1303    @Override
1304    protected void send(Protocol protocol) throws IOException {
1305      protocol.writeStructBegin("args");
1306      if (this.faces != null) {
1307        protocol.writeFieldBegin("faces", 1, TType.MAP);
1308        protocol.writeMapBegin(TType.STRING, TType.STRUCT, this.faces.size());
1309        for (Map.Entry<ByteString, CodeInfo> entry0 : this.faces.entrySet()) {
1310          ByteString key0 = entry0.getKey();
1311          CodeInfo value0 = entry0.getValue();
1312          protocol.writeBinary(key0);
1313          net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.write(protocol, value0);
1314        }
1315        protocol.writeMapEnd();
1316        protocol.writeFieldEnd();
1317      }
1318      protocol.writeFieldStop();
1319      protocol.writeStructEnd();
1320    }
1321
1322    @Override
1323    protected ByteString receive(Protocol protocol, MessageMetadata metadata) throws Exception {
1324      ByteString result = null;
1325      NotFaceDetectedException ex1 = null;
1326      ServiceRuntimeException ex2 = null;
1327      protocol.readStructBegin();
1328      while (true) {
1329        FieldMetadata field = protocol.readFieldBegin();
1330        if (field.typeId == TType.STOP) {
1331          break;
1332        }
1333        switch (field.fieldId) {
1334          case 0: {
1335            if (field.typeId == TType.STRING) {
1336              ByteString value = protocol.readBinary();
1337              result = value;
1338            } else {
1339              ProtocolUtil.skip(protocol, field.typeId);
1340            }
1341          }
1342          break;
1343          case 1: {
1344            if (field.typeId == TType.STRUCT) {
1345              net.gdface.sdk.thrift.client.NotFaceDetectedException value = net.gdface.sdk.thrift.client.NotFaceDetectedException.ADAPTER.read(protocol);
1346              ex1 = value;
1347            } else {
1348              ProtocolUtil.skip(protocol, field.typeId);
1349            }
1350          }
1351          break;
1352          case 2: {
1353            if (field.typeId == TType.STRUCT) {
1354              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
1355              ex2 = value;
1356            } else {
1357              ProtocolUtil.skip(protocol, field.typeId);
1358            }
1359          }
1360          break;
1361          default: ProtocolUtil.skip(protocol, field.typeId); break;
1362        }
1363        protocol.readFieldEnd();
1364      }
1365      protocol.readStructEnd();
1366      if (result != null) {
1367        return result;
1368      } else if (ex1 != null) {
1369        throw ex1;
1370      } else if (ex2 != null) {
1371        throw ex2;
1372      } else {
1373        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
1374      }
1375    }
1376  }
1377
1378  private static final class HasFaceCall extends MethodCall<Boolean> {
1379    private final ByteString imgData;
1380
1381    HasFaceCall(ByteString imgData, ServiceMethodCallback<Boolean> callback) {
1382      super("hasFace", TMessageType.CALL, callback);
1383      this.imgData = imgData;
1384    }
1385
1386    @Override
1387    protected void send(Protocol protocol) throws IOException {
1388      protocol.writeStructBegin("args");
1389      if (this.imgData != null) {
1390        protocol.writeFieldBegin("imgData", 1, TType.STRING);
1391        protocol.writeBinary(this.imgData);
1392        protocol.writeFieldEnd();
1393      }
1394      protocol.writeFieldStop();
1395      protocol.writeStructEnd();
1396    }
1397
1398    @Override
1399    protected Boolean receive(Protocol protocol, MessageMetadata metadata) throws Exception {
1400      Boolean result = null;
1401      ImageErrorException ex1 = null;
1402      ServiceRuntimeException ex2 = null;
1403      protocol.readStructBegin();
1404      while (true) {
1405        FieldMetadata field = protocol.readFieldBegin();
1406        if (field.typeId == TType.STOP) {
1407          break;
1408        }
1409        switch (field.fieldId) {
1410          case 0: {
1411            if (field.typeId == TType.BOOL) {
1412              boolean value = protocol.readBool();
1413              result = value;
1414            } else {
1415              ProtocolUtil.skip(protocol, field.typeId);
1416            }
1417          }
1418          break;
1419          case 1: {
1420            if (field.typeId == TType.STRUCT) {
1421              net.gdface.sdk.thrift.client.ImageErrorException value = net.gdface.sdk.thrift.client.ImageErrorException.ADAPTER.read(protocol);
1422              ex1 = value;
1423            } else {
1424              ProtocolUtil.skip(protocol, field.typeId);
1425            }
1426          }
1427          break;
1428          case 2: {
1429            if (field.typeId == TType.STRUCT) {
1430              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
1431              ex2 = value;
1432            } else {
1433              ProtocolUtil.skip(protocol, field.typeId);
1434            }
1435          }
1436          break;
1437          default: ProtocolUtil.skip(protocol, field.typeId); break;
1438        }
1439        protocol.readFieldEnd();
1440      }
1441      protocol.readStructEnd();
1442      if (result != null) {
1443        return result;
1444      } else if (ex1 != null) {
1445        throw ex1;
1446      } else if (ex2 != null) {
1447        throw ex2;
1448      } else {
1449        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
1450      }
1451    }
1452  }
1453
1454  private static final class IsLocalCall extends MethodCall<Boolean> {
1455    IsLocalCall(ServiceMethodCallback<Boolean> callback) {
1456      super("isLocal", TMessageType.CALL, callback);
1457    }
1458
1459    @Override
1460    protected void send(Protocol protocol) throws IOException {
1461      protocol.writeStructBegin("args");
1462      protocol.writeFieldStop();
1463      protocol.writeStructEnd();
1464    }
1465
1466    @Override
1467    protected Boolean receive(Protocol protocol, MessageMetadata metadata) throws Exception {
1468      Boolean result = null;
1469      ServiceRuntimeException ex1 = null;
1470      protocol.readStructBegin();
1471      while (true) {
1472        FieldMetadata field = protocol.readFieldBegin();
1473        if (field.typeId == TType.STOP) {
1474          break;
1475        }
1476        switch (field.fieldId) {
1477          case 0: {
1478            if (field.typeId == TType.BOOL) {
1479              boolean value = protocol.readBool();
1480              result = value;
1481            } else {
1482              ProtocolUtil.skip(protocol, field.typeId);
1483            }
1484          }
1485          break;
1486          case 1: {
1487            if (field.typeId == TType.STRUCT) {
1488              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
1489              ex1 = value;
1490            } else {
1491              ProtocolUtil.skip(protocol, field.typeId);
1492            }
1493          }
1494          break;
1495          default: ProtocolUtil.skip(protocol, field.typeId); break;
1496        }
1497        protocol.readFieldEnd();
1498      }
1499      protocol.readStructEnd();
1500      if (result != null) {
1501        return result;
1502      } else if (ex1 != null) {
1503        throw ex1;
1504      } else {
1505        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
1506      }
1507    }
1508  }
1509
1510  private static final class MatDetectAndGetCodeInfoCall extends MethodCall<List<CodeInfo>> {
1511    private final MatType matType;
1512
1513    private final ByteString matData;
1514
1515    private final Integer width;
1516
1517    private final Integer height;
1518
1519    private final Integer faceNum;
1520
1521    MatDetectAndGetCodeInfoCall(MatType matType, ByteString matData, Integer width, Integer height,
1522        Integer faceNum, ServiceMethodCallback<List<CodeInfo>> callback) {
1523      super("matDetectAndGetCodeInfo", TMessageType.CALL, callback);
1524      this.matType = matType;
1525      this.matData = matData;
1526      if (width == null) throw new NullPointerException("width");
1527      this.width = width;
1528      if (height == null) throw new NullPointerException("height");
1529      this.height = height;
1530      if (faceNum == null) throw new NullPointerException("faceNum");
1531      this.faceNum = faceNum;
1532    }
1533
1534    @Override
1535    protected void send(Protocol protocol) throws IOException {
1536      protocol.writeStructBegin("args");
1537      if (this.matType != null) {
1538        protocol.writeFieldBegin("matType", 1, TType.I32);
1539        protocol.writeI32(this.matType.value);
1540        protocol.writeFieldEnd();
1541      }
1542      if (this.matData != null) {
1543        protocol.writeFieldBegin("matData", 2, TType.STRING);
1544        protocol.writeBinary(this.matData);
1545        protocol.writeFieldEnd();
1546      }
1547      protocol.writeFieldBegin("width", 3, TType.I32);
1548      protocol.writeI32(this.width);
1549      protocol.writeFieldEnd();
1550      protocol.writeFieldBegin("height", 4, TType.I32);
1551      protocol.writeI32(this.height);
1552      protocol.writeFieldEnd();
1553      protocol.writeFieldBegin("faceNum", 5, TType.I32);
1554      protocol.writeI32(this.faceNum);
1555      protocol.writeFieldEnd();
1556      protocol.writeFieldStop();
1557      protocol.writeStructEnd();
1558    }
1559
1560    @Override
1561    protected List<CodeInfo> receive(Protocol protocol, MessageMetadata metadata) throws Exception {
1562      List<CodeInfo> result = null;
1563      NotFaceDetectedException ex1 = null;
1564      ServiceRuntimeException ex2 = null;
1565      protocol.readStructBegin();
1566      while (true) {
1567        FieldMetadata field = protocol.readFieldBegin();
1568        if (field.typeId == TType.STOP) {
1569          break;
1570        }
1571        switch (field.fieldId) {
1572          case 0: {
1573            if (field.typeId == TType.LIST) {
1574              ListMetadata listMetadata0 = protocol.readListBegin();
1575              List<CodeInfo> value = new ArrayList<CodeInfo>(listMetadata0.size);
1576              for (int i0 = 0; i0 < listMetadata0.size; ++i0) {
1577                net.gdface.sdk.thrift.client.CodeInfo item0 = net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.read(protocol);
1578                value.add(item0);
1579              }
1580              protocol.readListEnd();
1581              result = value;
1582            } else {
1583              ProtocolUtil.skip(protocol, field.typeId);
1584            }
1585          }
1586          break;
1587          case 1: {
1588            if (field.typeId == TType.STRUCT) {
1589              net.gdface.sdk.thrift.client.NotFaceDetectedException value = net.gdface.sdk.thrift.client.NotFaceDetectedException.ADAPTER.read(protocol);
1590              ex1 = value;
1591            } else {
1592              ProtocolUtil.skip(protocol, field.typeId);
1593            }
1594          }
1595          break;
1596          case 2: {
1597            if (field.typeId == TType.STRUCT) {
1598              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
1599              ex2 = value;
1600            } else {
1601              ProtocolUtil.skip(protocol, field.typeId);
1602            }
1603          }
1604          break;
1605          default: ProtocolUtil.skip(protocol, field.typeId); break;
1606        }
1607        protocol.readFieldEnd();
1608      }
1609      protocol.readStructEnd();
1610      if (result != null) {
1611        return result;
1612      } else if (ex1 != null) {
1613        throw ex1;
1614      } else if (ex2 != null) {
1615        throw ex2;
1616      } else {
1617        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
1618      }
1619    }
1620  }
1621
1622  private static final class MatDetectFaceCall extends MethodCall<List<CodeInfo>> {
1623    private final MatType matType;
1624
1625    private final ByteString matData;
1626
1627    private final Integer width;
1628
1629    private final Integer height;
1630
1631    MatDetectFaceCall(MatType matType, ByteString matData, Integer width, Integer height,
1632        ServiceMethodCallback<List<CodeInfo>> callback) {
1633      super("matDetectFace", TMessageType.CALL, callback);
1634      this.matType = matType;
1635      this.matData = matData;
1636      if (width == null) throw new NullPointerException("width");
1637      this.width = width;
1638      if (height == null) throw new NullPointerException("height");
1639      this.height = height;
1640    }
1641
1642    @Override
1643    protected void send(Protocol protocol) throws IOException {
1644      protocol.writeStructBegin("args");
1645      if (this.matType != null) {
1646        protocol.writeFieldBegin("matType", 1, TType.I32);
1647        protocol.writeI32(this.matType.value);
1648        protocol.writeFieldEnd();
1649      }
1650      if (this.matData != null) {
1651        protocol.writeFieldBegin("matData", 2, TType.STRING);
1652        protocol.writeBinary(this.matData);
1653        protocol.writeFieldEnd();
1654      }
1655      protocol.writeFieldBegin("width", 3, TType.I32);
1656      protocol.writeI32(this.width);
1657      protocol.writeFieldEnd();
1658      protocol.writeFieldBegin("height", 4, TType.I32);
1659      protocol.writeI32(this.height);
1660      protocol.writeFieldEnd();
1661      protocol.writeFieldStop();
1662      protocol.writeStructEnd();
1663    }
1664
1665    @Override
1666    protected List<CodeInfo> receive(Protocol protocol, MessageMetadata metadata) throws Exception {
1667      List<CodeInfo> result = null;
1668      ServiceRuntimeException ex1 = null;
1669      protocol.readStructBegin();
1670      while (true) {
1671        FieldMetadata field = protocol.readFieldBegin();
1672        if (field.typeId == TType.STOP) {
1673          break;
1674        }
1675        switch (field.fieldId) {
1676          case 0: {
1677            if (field.typeId == TType.LIST) {
1678              ListMetadata listMetadata0 = protocol.readListBegin();
1679              List<CodeInfo> value = new ArrayList<CodeInfo>(listMetadata0.size);
1680              for (int i0 = 0; i0 < listMetadata0.size; ++i0) {
1681                net.gdface.sdk.thrift.client.CodeInfo item0 = net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.read(protocol);
1682                value.add(item0);
1683              }
1684              protocol.readListEnd();
1685              result = value;
1686            } else {
1687              ProtocolUtil.skip(protocol, field.typeId);
1688            }
1689          }
1690          break;
1691          case 1: {
1692            if (field.typeId == TType.STRUCT) {
1693              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
1694              ex1 = value;
1695            } else {
1696              ProtocolUtil.skip(protocol, field.typeId);
1697            }
1698          }
1699          break;
1700          default: ProtocolUtil.skip(protocol, field.typeId); break;
1701        }
1702        protocol.readFieldEnd();
1703      }
1704      protocol.readStructEnd();
1705      if (result != null) {
1706        return result;
1707      } else if (ex1 != null) {
1708        throw ex1;
1709      } else {
1710        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
1711      }
1712    }
1713  }
1714
1715  private static final class MatDetectMaxFaceCall extends MethodCall<CodeInfo> {
1716    private final MatType matType;
1717
1718    private final ByteString matData;
1719
1720    private final Integer width;
1721
1722    private final Integer height;
1723
1724    MatDetectMaxFaceCall(MatType matType, ByteString matData, Integer width, Integer height,
1725        ServiceMethodCallback<CodeInfo> callback) {
1726      super("matDetectMaxFace", TMessageType.CALL, callback);
1727      this.matType = matType;
1728      this.matData = matData;
1729      if (width == null) throw new NullPointerException("width");
1730      this.width = width;
1731      if (height == null) throw new NullPointerException("height");
1732      this.height = height;
1733    }
1734
1735    @Override
1736    protected void send(Protocol protocol) throws IOException {
1737      protocol.writeStructBegin("args");
1738      if (this.matType != null) {
1739        protocol.writeFieldBegin("matType", 1, TType.I32);
1740        protocol.writeI32(this.matType.value);
1741        protocol.writeFieldEnd();
1742      }
1743      if (this.matData != null) {
1744        protocol.writeFieldBegin("matData", 2, TType.STRING);
1745        protocol.writeBinary(this.matData);
1746        protocol.writeFieldEnd();
1747      }
1748      protocol.writeFieldBegin("width", 3, TType.I32);
1749      protocol.writeI32(this.width);
1750      protocol.writeFieldEnd();
1751      protocol.writeFieldBegin("height", 4, TType.I32);
1752      protocol.writeI32(this.height);
1753      protocol.writeFieldEnd();
1754      protocol.writeFieldStop();
1755      protocol.writeStructEnd();
1756    }
1757
1758    @Override
1759    protected CodeInfo receive(Protocol protocol, MessageMetadata metadata) throws Exception {
1760      CodeInfo result = null;
1761      NotFaceDetectedException ex1 = null;
1762      ServiceRuntimeException ex2 = null;
1763      protocol.readStructBegin();
1764      while (true) {
1765        FieldMetadata field = protocol.readFieldBegin();
1766        if (field.typeId == TType.STOP) {
1767          break;
1768        }
1769        switch (field.fieldId) {
1770          case 0: {
1771            if (field.typeId == TType.STRUCT) {
1772              net.gdface.sdk.thrift.client.CodeInfo value = net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.read(protocol);
1773              result = value;
1774            } else {
1775              ProtocolUtil.skip(protocol, field.typeId);
1776            }
1777          }
1778          break;
1779          case 1: {
1780            if (field.typeId == TType.STRUCT) {
1781              net.gdface.sdk.thrift.client.NotFaceDetectedException value = net.gdface.sdk.thrift.client.NotFaceDetectedException.ADAPTER.read(protocol);
1782              ex1 = value;
1783            } else {
1784              ProtocolUtil.skip(protocol, field.typeId);
1785            }
1786          }
1787          break;
1788          case 2: {
1789            if (field.typeId == TType.STRUCT) {
1790              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
1791              ex2 = value;
1792            } else {
1793              ProtocolUtil.skip(protocol, field.typeId);
1794            }
1795          }
1796          break;
1797          default: ProtocolUtil.skip(protocol, field.typeId); break;
1798        }
1799        protocol.readFieldEnd();
1800      }
1801      protocol.readStructEnd();
1802      if (result != null) {
1803        return result;
1804      } else if (ex1 != null) {
1805        throw ex1;
1806      } else if (ex2 != null) {
1807        throw ex2;
1808      } else {
1809        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
1810      }
1811    }
1812  }
1813
1814  private static final class MatGetCodeInfoCall extends MethodCall<List<CodeInfo>> {
1815    private final MatType matType;
1816
1817    private final ByteString matData;
1818
1819    private final Integer width;
1820
1821    private final Integer height;
1822
1823    private final Integer facenum;
1824
1825    private final List<CodeInfo> facePos;
1826
1827    MatGetCodeInfoCall(MatType matType, ByteString matData, Integer width, Integer height,
1828        Integer facenum, List<CodeInfo> facePos, ServiceMethodCallback<List<CodeInfo>> callback) {
1829      super("matGetCodeInfo", TMessageType.CALL, callback);
1830      this.matType = matType;
1831      this.matData = matData;
1832      if (width == null) throw new NullPointerException("width");
1833      this.width = width;
1834      if (height == null) throw new NullPointerException("height");
1835      this.height = height;
1836      if (facenum == null) throw new NullPointerException("facenum");
1837      this.facenum = facenum;
1838      this.facePos = facePos;
1839    }
1840
1841    @Override
1842    protected void send(Protocol protocol) throws IOException {
1843      protocol.writeStructBegin("args");
1844      if (this.matType != null) {
1845        protocol.writeFieldBegin("matType", 1, TType.I32);
1846        protocol.writeI32(this.matType.value);
1847        protocol.writeFieldEnd();
1848      }
1849      if (this.matData != null) {
1850        protocol.writeFieldBegin("matData", 2, TType.STRING);
1851        protocol.writeBinary(this.matData);
1852        protocol.writeFieldEnd();
1853      }
1854      protocol.writeFieldBegin("width", 3, TType.I32);
1855      protocol.writeI32(this.width);
1856      protocol.writeFieldEnd();
1857      protocol.writeFieldBegin("height", 4, TType.I32);
1858      protocol.writeI32(this.height);
1859      protocol.writeFieldEnd();
1860      protocol.writeFieldBegin("facenum", 5, TType.I32);
1861      protocol.writeI32(this.facenum);
1862      protocol.writeFieldEnd();
1863      if (this.facePos != null) {
1864        protocol.writeFieldBegin("facePos", 6, TType.LIST);
1865        protocol.writeListBegin(TType.STRUCT, this.facePos.size());
1866        for (CodeInfo item0 : this.facePos) {
1867          net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.write(protocol, item0);
1868        }
1869        protocol.writeListEnd();
1870        protocol.writeFieldEnd();
1871      }
1872      protocol.writeFieldStop();
1873      protocol.writeStructEnd();
1874    }
1875
1876    @Override
1877    protected List<CodeInfo> receive(Protocol protocol, MessageMetadata metadata) throws Exception {
1878      List<CodeInfo> result = null;
1879      NotFaceDetectedException ex1 = null;
1880      ServiceRuntimeException ex2 = null;
1881      protocol.readStructBegin();
1882      while (true) {
1883        FieldMetadata field = protocol.readFieldBegin();
1884        if (field.typeId == TType.STOP) {
1885          break;
1886        }
1887        switch (field.fieldId) {
1888          case 0: {
1889            if (field.typeId == TType.LIST) {
1890              ListMetadata listMetadata0 = protocol.readListBegin();
1891              List<CodeInfo> value = new ArrayList<CodeInfo>(listMetadata0.size);
1892              for (int i0 = 0; i0 < listMetadata0.size; ++i0) {
1893                net.gdface.sdk.thrift.client.CodeInfo item0 = net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.read(protocol);
1894                value.add(item0);
1895              }
1896              protocol.readListEnd();
1897              result = value;
1898            } else {
1899              ProtocolUtil.skip(protocol, field.typeId);
1900            }
1901          }
1902          break;
1903          case 1: {
1904            if (field.typeId == TType.STRUCT) {
1905              net.gdface.sdk.thrift.client.NotFaceDetectedException value = net.gdface.sdk.thrift.client.NotFaceDetectedException.ADAPTER.read(protocol);
1906              ex1 = value;
1907            } else {
1908              ProtocolUtil.skip(protocol, field.typeId);
1909            }
1910          }
1911          break;
1912          case 2: {
1913            if (field.typeId == TType.STRUCT) {
1914              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
1915              ex2 = value;
1916            } else {
1917              ProtocolUtil.skip(protocol, field.typeId);
1918            }
1919          }
1920          break;
1921          default: ProtocolUtil.skip(protocol, field.typeId); break;
1922        }
1923        protocol.readFieldEnd();
1924      }
1925      protocol.readStructEnd();
1926      if (result != null) {
1927        return result;
1928      } else if (ex1 != null) {
1929        throw ex1;
1930      } else if (ex2 != null) {
1931        throw ex2;
1932      } else {
1933        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
1934      }
1935    }
1936  }
1937
1938  private static final class MatGetCodeInfoSingleCall extends MethodCall<CodeInfo> {
1939    private final MatType matType;
1940
1941    private final ByteString matData;
1942
1943    private final Integer width;
1944
1945    private final Integer height;
1946
1947    private final CodeInfo facePos;
1948
1949    MatGetCodeInfoSingleCall(MatType matType, ByteString matData, Integer width, Integer height,
1950        CodeInfo facePos, ServiceMethodCallback<CodeInfo> callback) {
1951      super("matGetCodeInfoSingle", TMessageType.CALL, callback);
1952      this.matType = matType;
1953      this.matData = matData;
1954      if (width == null) throw new NullPointerException("width");
1955      this.width = width;
1956      if (height == null) throw new NullPointerException("height");
1957      this.height = height;
1958      this.facePos = facePos;
1959    }
1960
1961    @Override
1962    protected void send(Protocol protocol) throws IOException {
1963      protocol.writeStructBegin("args");
1964      if (this.matType != null) {
1965        protocol.writeFieldBegin("matType", 1, TType.I32);
1966        protocol.writeI32(this.matType.value);
1967        protocol.writeFieldEnd();
1968      }
1969      if (this.matData != null) {
1970        protocol.writeFieldBegin("matData", 2, TType.STRING);
1971        protocol.writeBinary(this.matData);
1972        protocol.writeFieldEnd();
1973      }
1974      protocol.writeFieldBegin("width", 3, TType.I32);
1975      protocol.writeI32(this.width);
1976      protocol.writeFieldEnd();
1977      protocol.writeFieldBegin("height", 4, TType.I32);
1978      protocol.writeI32(this.height);
1979      protocol.writeFieldEnd();
1980      if (this.facePos != null) {
1981        protocol.writeFieldBegin("facePos", 5, TType.STRUCT);
1982        net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.write(protocol, this.facePos);
1983        protocol.writeFieldEnd();
1984      }
1985      protocol.writeFieldStop();
1986      protocol.writeStructEnd();
1987    }
1988
1989    @Override
1990    protected CodeInfo receive(Protocol protocol, MessageMetadata metadata) throws Exception {
1991      CodeInfo result = null;
1992      ServiceRuntimeException ex1 = null;
1993      protocol.readStructBegin();
1994      while (true) {
1995        FieldMetadata field = protocol.readFieldBegin();
1996        if (field.typeId == TType.STOP) {
1997          break;
1998        }
1999        switch (field.fieldId) {
2000          case 0: {
2001            if (field.typeId == TType.STRUCT) {
2002              net.gdface.sdk.thrift.client.CodeInfo value = net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.read(protocol);
2003              result = value;
2004            } else {
2005              ProtocolUtil.skip(protocol, field.typeId);
2006            }
2007          }
2008          break;
2009          case 1: {
2010            if (field.typeId == TType.STRUCT) {
2011              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
2012              ex1 = value;
2013            } else {
2014              ProtocolUtil.skip(protocol, field.typeId);
2015            }
2016          }
2017          break;
2018          default: ProtocolUtil.skip(protocol, field.typeId); break;
2019        }
2020        protocol.readFieldEnd();
2021      }
2022      protocol.readStructEnd();
2023      if (result != null) {
2024        return result;
2025      } else if (ex1 != null) {
2026        throw ex1;
2027      } else {
2028        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
2029      }
2030    }
2031  }
2032
2033  private static final class MatHasFaceCall extends MethodCall<Boolean> {
2034    private final MatType matType;
2035
2036    private final ByteString matData;
2037
2038    private final Integer width;
2039
2040    private final Integer height;
2041
2042    MatHasFaceCall(MatType matType, ByteString matData, Integer width, Integer height,
2043        ServiceMethodCallback<Boolean> callback) {
2044      super("matHasFace", TMessageType.CALL, callback);
2045      this.matType = matType;
2046      this.matData = matData;
2047      if (width == null) throw new NullPointerException("width");
2048      this.width = width;
2049      if (height == null) throw new NullPointerException("height");
2050      this.height = height;
2051    }
2052
2053    @Override
2054    protected void send(Protocol protocol) throws IOException {
2055      protocol.writeStructBegin("args");
2056      if (this.matType != null) {
2057        protocol.writeFieldBegin("matType", 1, TType.I32);
2058        protocol.writeI32(this.matType.value);
2059        protocol.writeFieldEnd();
2060      }
2061      if (this.matData != null) {
2062        protocol.writeFieldBegin("matData", 2, TType.STRING);
2063        protocol.writeBinary(this.matData);
2064        protocol.writeFieldEnd();
2065      }
2066      protocol.writeFieldBegin("width", 3, TType.I32);
2067      protocol.writeI32(this.width);
2068      protocol.writeFieldEnd();
2069      protocol.writeFieldBegin("height", 4, TType.I32);
2070      protocol.writeI32(this.height);
2071      protocol.writeFieldEnd();
2072      protocol.writeFieldStop();
2073      protocol.writeStructEnd();
2074    }
2075
2076    @Override
2077    protected Boolean receive(Protocol protocol, MessageMetadata metadata) throws Exception {
2078      Boolean result = null;
2079      ServiceRuntimeException ex1 = null;
2080      protocol.readStructBegin();
2081      while (true) {
2082        FieldMetadata field = protocol.readFieldBegin();
2083        if (field.typeId == TType.STOP) {
2084          break;
2085        }
2086        switch (field.fieldId) {
2087          case 0: {
2088            if (field.typeId == TType.BOOL) {
2089              boolean value = protocol.readBool();
2090              result = value;
2091            } else {
2092              ProtocolUtil.skip(protocol, field.typeId);
2093            }
2094          }
2095          break;
2096          case 1: {
2097            if (field.typeId == TType.STRUCT) {
2098              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
2099              ex1 = value;
2100            } else {
2101              ProtocolUtil.skip(protocol, field.typeId);
2102            }
2103          }
2104          break;
2105          default: ProtocolUtil.skip(protocol, field.typeId); break;
2106        }
2107        protocol.readFieldEnd();
2108      }
2109      protocol.readStructEnd();
2110      if (result != null) {
2111        return result;
2112      } else if (ex1 != null) {
2113        throw ex1;
2114      } else {
2115        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
2116      }
2117    }
2118  }
2119
2120  private static final class MatSearchFacesCall extends MethodCall<List<FseResult>> {
2121    private final MatType matType;
2122
2123    private final ByteString matData;
2124
2125    private final Integer width;
2126
2127    private final Integer height;
2128
2129    private final CodeInfo facePos;
2130
2131    private final Double similarty;
2132
2133    private final Integer rows;
2134
2135    MatSearchFacesCall(MatType matType, ByteString matData, Integer width, Integer height,
2136        CodeInfo facePos, Double similarty, Integer rows,
2137        ServiceMethodCallback<List<FseResult>> callback) {
2138      super("matSearchFaces", TMessageType.CALL, callback);
2139      this.matType = matType;
2140      this.matData = matData;
2141      if (width == null) throw new NullPointerException("width");
2142      this.width = width;
2143      if (height == null) throw new NullPointerException("height");
2144      this.height = height;
2145      this.facePos = facePos;
2146      if (similarty == null) throw new NullPointerException("similarty");
2147      this.similarty = similarty;
2148      if (rows == null) throw new NullPointerException("rows");
2149      this.rows = rows;
2150    }
2151
2152    @Override
2153    protected void send(Protocol protocol) throws IOException {
2154      protocol.writeStructBegin("args");
2155      if (this.matType != null) {
2156        protocol.writeFieldBegin("matType", 1, TType.I32);
2157        protocol.writeI32(this.matType.value);
2158        protocol.writeFieldEnd();
2159      }
2160      if (this.matData != null) {
2161        protocol.writeFieldBegin("matData", 2, TType.STRING);
2162        protocol.writeBinary(this.matData);
2163        protocol.writeFieldEnd();
2164      }
2165      protocol.writeFieldBegin("width", 3, TType.I32);
2166      protocol.writeI32(this.width);
2167      protocol.writeFieldEnd();
2168      protocol.writeFieldBegin("height", 4, TType.I32);
2169      protocol.writeI32(this.height);
2170      protocol.writeFieldEnd();
2171      if (this.facePos != null) {
2172        protocol.writeFieldBegin("facePos", 5, TType.STRUCT);
2173        net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.write(protocol, this.facePos);
2174        protocol.writeFieldEnd();
2175      }
2176      protocol.writeFieldBegin("similarty", 6, TType.DOUBLE);
2177      protocol.writeDouble(this.similarty);
2178      protocol.writeFieldEnd();
2179      protocol.writeFieldBegin("rows", 7, TType.I32);
2180      protocol.writeI32(this.rows);
2181      protocol.writeFieldEnd();
2182      protocol.writeFieldStop();
2183      protocol.writeStructEnd();
2184    }
2185
2186    @Override
2187    protected List<FseResult> receive(Protocol protocol, MessageMetadata metadata) throws
2188        Exception {
2189      List<FseResult> result = null;
2190      ImageErrorException ex1 = null;
2191      NotFaceDetectedException ex2 = null;
2192      ServiceRuntimeException ex3 = null;
2193      protocol.readStructBegin();
2194      while (true) {
2195        FieldMetadata field = protocol.readFieldBegin();
2196        if (field.typeId == TType.STOP) {
2197          break;
2198        }
2199        switch (field.fieldId) {
2200          case 0: {
2201            if (field.typeId == TType.LIST) {
2202              ListMetadata listMetadata0 = protocol.readListBegin();
2203              List<FseResult> value = new ArrayList<FseResult>(listMetadata0.size);
2204              for (int i0 = 0; i0 < listMetadata0.size; ++i0) {
2205                net.gdface.sdk.thrift.client.FseResult item0 = net.gdface.sdk.thrift.client.FseResult.ADAPTER.read(protocol);
2206                value.add(item0);
2207              }
2208              protocol.readListEnd();
2209              result = value;
2210            } else {
2211              ProtocolUtil.skip(protocol, field.typeId);
2212            }
2213          }
2214          break;
2215          case 1: {
2216            if (field.typeId == TType.STRUCT) {
2217              net.gdface.sdk.thrift.client.ImageErrorException value = net.gdface.sdk.thrift.client.ImageErrorException.ADAPTER.read(protocol);
2218              ex1 = value;
2219            } else {
2220              ProtocolUtil.skip(protocol, field.typeId);
2221            }
2222          }
2223          break;
2224          case 2: {
2225            if (field.typeId == TType.STRUCT) {
2226              net.gdface.sdk.thrift.client.NotFaceDetectedException value = net.gdface.sdk.thrift.client.NotFaceDetectedException.ADAPTER.read(protocol);
2227              ex2 = value;
2228            } else {
2229              ProtocolUtil.skip(protocol, field.typeId);
2230            }
2231          }
2232          break;
2233          case 3: {
2234            if (field.typeId == TType.STRUCT) {
2235              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
2236              ex3 = value;
2237            } else {
2238              ProtocolUtil.skip(protocol, field.typeId);
2239            }
2240          }
2241          break;
2242          default: ProtocolUtil.skip(protocol, field.typeId); break;
2243        }
2244        protocol.readFieldEnd();
2245      }
2246      protocol.readStructEnd();
2247      if (result != null) {
2248        return result;
2249      } else if (ex1 != null) {
2250        throw ex1;
2251      } else if (ex2 != null) {
2252        throw ex2;
2253      } else if (ex3 != null) {
2254        throw ex3;
2255      } else {
2256        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
2257      }
2258    }
2259  }
2260
2261  private static final class MatWearMaskCall extends MethodCall<Boolean> {
2262    private final MatType matType;
2263
2264    private final ByteString matData;
2265
2266    private final Integer width;
2267
2268    private final Integer height;
2269
2270    private final CodeInfo faceInfo;
2271
2272    MatWearMaskCall(MatType matType, ByteString matData, Integer width, Integer height,
2273        CodeInfo faceInfo, ServiceMethodCallback<Boolean> callback) {
2274      super("matWearMask", TMessageType.CALL, callback);
2275      this.matType = matType;
2276      this.matData = matData;
2277      if (width == null) throw new NullPointerException("width");
2278      this.width = width;
2279      if (height == null) throw new NullPointerException("height");
2280      this.height = height;
2281      this.faceInfo = faceInfo;
2282    }
2283
2284    @Override
2285    protected void send(Protocol protocol) throws IOException {
2286      protocol.writeStructBegin("args");
2287      if (this.matType != null) {
2288        protocol.writeFieldBegin("matType", 1, TType.I32);
2289        protocol.writeI32(this.matType.value);
2290        protocol.writeFieldEnd();
2291      }
2292      if (this.matData != null) {
2293        protocol.writeFieldBegin("matData", 2, TType.STRING);
2294        protocol.writeBinary(this.matData);
2295        protocol.writeFieldEnd();
2296      }
2297      protocol.writeFieldBegin("width", 3, TType.I32);
2298      protocol.writeI32(this.width);
2299      protocol.writeFieldEnd();
2300      protocol.writeFieldBegin("height", 4, TType.I32);
2301      protocol.writeI32(this.height);
2302      protocol.writeFieldEnd();
2303      if (this.faceInfo != null) {
2304        protocol.writeFieldBegin("faceInfo", 5, TType.STRUCT);
2305        net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.write(protocol, this.faceInfo);
2306        protocol.writeFieldEnd();
2307      }
2308      protocol.writeFieldStop();
2309      protocol.writeStructEnd();
2310    }
2311
2312    @Override
2313    protected Boolean receive(Protocol protocol, MessageMetadata metadata) throws Exception {
2314      Boolean result = null;
2315      ServiceRuntimeException ex1 = null;
2316      protocol.readStructBegin();
2317      while (true) {
2318        FieldMetadata field = protocol.readFieldBegin();
2319        if (field.typeId == TType.STOP) {
2320          break;
2321        }
2322        switch (field.fieldId) {
2323          case 0: {
2324            if (field.typeId == TType.BOOL) {
2325              boolean value = protocol.readBool();
2326              result = value;
2327            } else {
2328              ProtocolUtil.skip(protocol, field.typeId);
2329            }
2330          }
2331          break;
2332          case 1: {
2333            if (field.typeId == TType.STRUCT) {
2334              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
2335              ex1 = value;
2336            } else {
2337              ProtocolUtil.skip(protocol, field.typeId);
2338            }
2339          }
2340          break;
2341          default: ProtocolUtil.skip(protocol, field.typeId); break;
2342        }
2343        protocol.readFieldEnd();
2344      }
2345      protocol.readStructEnd();
2346      if (result != null) {
2347        return result;
2348      } else if (ex1 != null) {
2349        throw ex1;
2350      } else {
2351        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
2352      }
2353    }
2354  }
2355
2356  private static final class SdkCapacityCall extends MethodCall<Map<String, String>> {
2357    SdkCapacityCall(ServiceMethodCallback<Map<String, String>> callback) {
2358      super("sdkCapacity", TMessageType.CALL, callback);
2359    }
2360
2361    @Override
2362    protected void send(Protocol protocol) throws IOException {
2363      protocol.writeStructBegin("args");
2364      protocol.writeFieldStop();
2365      protocol.writeStructEnd();
2366    }
2367
2368    @Override
2369    protected Map<String, String> receive(Protocol protocol, MessageMetadata metadata) throws
2370        Exception {
2371      Map<String, String> result = null;
2372      ServiceRuntimeException ex1 = null;
2373      protocol.readStructBegin();
2374      while (true) {
2375        FieldMetadata field = protocol.readFieldBegin();
2376        if (field.typeId == TType.STOP) {
2377          break;
2378        }
2379        switch (field.fieldId) {
2380          case 0: {
2381            if (field.typeId == TType.MAP) {
2382              MapMetadata mapMetadata0 = protocol.readMapBegin();
2383              Map<String, String> value = new HashMap<String, String>(mapMetadata0.size);
2384              for (int i0 = 0; i0 < mapMetadata0.size; ++i0) {
2385                String key0 = protocol.readString();
2386                String value0 = protocol.readString();
2387                value.put(key0, value0);
2388              }
2389              protocol.readMapEnd();
2390              result = value;
2391            } else {
2392              ProtocolUtil.skip(protocol, field.typeId);
2393            }
2394          }
2395          break;
2396          case 1: {
2397            if (field.typeId == TType.STRUCT) {
2398              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
2399              ex1 = value;
2400            } else {
2401              ProtocolUtil.skip(protocol, field.typeId);
2402            }
2403          }
2404          break;
2405          default: ProtocolUtil.skip(protocol, field.typeId); break;
2406        }
2407        protocol.readFieldEnd();
2408      }
2409      protocol.readStructEnd();
2410      if (result != null) {
2411        return result;
2412      } else if (ex1 != null) {
2413        throw ex1;
2414      } else {
2415        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
2416      }
2417    }
2418  }
2419
2420  private static final class SearchFacesCall extends MethodCall<List<FseResult>> {
2421    private final ByteString imgData;
2422
2423    private final CodeInfo facePos;
2424
2425    private final Double similarty;
2426
2427    private final Integer rows;
2428
2429    SearchFacesCall(ByteString imgData, CodeInfo facePos, Double similarty, Integer rows,
2430        ServiceMethodCallback<List<FseResult>> callback) {
2431      super("searchFaces", TMessageType.CALL, callback);
2432      this.imgData = imgData;
2433      this.facePos = facePos;
2434      if (similarty == null) throw new NullPointerException("similarty");
2435      this.similarty = similarty;
2436      if (rows == null) throw new NullPointerException("rows");
2437      this.rows = rows;
2438    }
2439
2440    @Override
2441    protected void send(Protocol protocol) throws IOException {
2442      protocol.writeStructBegin("args");
2443      if (this.imgData != null) {
2444        protocol.writeFieldBegin("imgData", 1, TType.STRING);
2445        protocol.writeBinary(this.imgData);
2446        protocol.writeFieldEnd();
2447      }
2448      if (this.facePos != null) {
2449        protocol.writeFieldBegin("facePos", 2, TType.STRUCT);
2450        net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.write(protocol, this.facePos);
2451        protocol.writeFieldEnd();
2452      }
2453      protocol.writeFieldBegin("similarty", 3, TType.DOUBLE);
2454      protocol.writeDouble(this.similarty);
2455      protocol.writeFieldEnd();
2456      protocol.writeFieldBegin("rows", 4, TType.I32);
2457      protocol.writeI32(this.rows);
2458      protocol.writeFieldEnd();
2459      protocol.writeFieldStop();
2460      protocol.writeStructEnd();
2461    }
2462
2463    @Override
2464    protected List<FseResult> receive(Protocol protocol, MessageMetadata metadata) throws
2465        Exception {
2466      List<FseResult> result = null;
2467      ImageErrorException ex1 = null;
2468      NotFaceDetectedException ex2 = null;
2469      ServiceRuntimeException ex3 = null;
2470      protocol.readStructBegin();
2471      while (true) {
2472        FieldMetadata field = protocol.readFieldBegin();
2473        if (field.typeId == TType.STOP) {
2474          break;
2475        }
2476        switch (field.fieldId) {
2477          case 0: {
2478            if (field.typeId == TType.LIST) {
2479              ListMetadata listMetadata0 = protocol.readListBegin();
2480              List<FseResult> value = new ArrayList<FseResult>(listMetadata0.size);
2481              for (int i0 = 0; i0 < listMetadata0.size; ++i0) {
2482                net.gdface.sdk.thrift.client.FseResult item0 = net.gdface.sdk.thrift.client.FseResult.ADAPTER.read(protocol);
2483                value.add(item0);
2484              }
2485              protocol.readListEnd();
2486              result = value;
2487            } else {
2488              ProtocolUtil.skip(protocol, field.typeId);
2489            }
2490          }
2491          break;
2492          case 1: {
2493            if (field.typeId == TType.STRUCT) {
2494              net.gdface.sdk.thrift.client.ImageErrorException value = net.gdface.sdk.thrift.client.ImageErrorException.ADAPTER.read(protocol);
2495              ex1 = value;
2496            } else {
2497              ProtocolUtil.skip(protocol, field.typeId);
2498            }
2499          }
2500          break;
2501          case 2: {
2502            if (field.typeId == TType.STRUCT) {
2503              net.gdface.sdk.thrift.client.NotFaceDetectedException value = net.gdface.sdk.thrift.client.NotFaceDetectedException.ADAPTER.read(protocol);
2504              ex2 = value;
2505            } else {
2506              ProtocolUtil.skip(protocol, field.typeId);
2507            }
2508          }
2509          break;
2510          case 3: {
2511            if (field.typeId == TType.STRUCT) {
2512              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
2513              ex3 = value;
2514            } else {
2515              ProtocolUtil.skip(protocol, field.typeId);
2516            }
2517          }
2518          break;
2519          default: ProtocolUtil.skip(protocol, field.typeId); break;
2520        }
2521        protocol.readFieldEnd();
2522      }
2523      protocol.readStructEnd();
2524      if (result != null) {
2525        return result;
2526      } else if (ex1 != null) {
2527        throw ex1;
2528      } else if (ex2 != null) {
2529        throw ex2;
2530      } else if (ex3 != null) {
2531        throw ex3;
2532      } else {
2533        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
2534      }
2535    }
2536  }
2537
2538  private static final class SearchFeaturesCall extends MethodCall<List<FseResult>> {
2539    private final ByteString feature;
2540
2541    private final Double similarty;
2542
2543    private final Integer rows;
2544
2545    SearchFeaturesCall(ByteString feature, Double similarty, Integer rows,
2546        ServiceMethodCallback<List<FseResult>> callback) {
2547      super("searchFeatures", TMessageType.CALL, callback);
2548      this.feature = feature;
2549      if (similarty == null) throw new NullPointerException("similarty");
2550      this.similarty = similarty;
2551      if (rows == null) throw new NullPointerException("rows");
2552      this.rows = rows;
2553    }
2554
2555    @Override
2556    protected void send(Protocol protocol) throws IOException {
2557      protocol.writeStructBegin("args");
2558      if (this.feature != null) {
2559        protocol.writeFieldBegin("feature", 1, TType.STRING);
2560        protocol.writeBinary(this.feature);
2561        protocol.writeFieldEnd();
2562      }
2563      protocol.writeFieldBegin("similarty", 2, TType.DOUBLE);
2564      protocol.writeDouble(this.similarty);
2565      protocol.writeFieldEnd();
2566      protocol.writeFieldBegin("rows", 3, TType.I32);
2567      protocol.writeI32(this.rows);
2568      protocol.writeFieldEnd();
2569      protocol.writeFieldStop();
2570      protocol.writeStructEnd();
2571    }
2572
2573    @Override
2574    protected List<FseResult> receive(Protocol protocol, MessageMetadata metadata) throws
2575        Exception {
2576      List<FseResult> result = null;
2577      ServiceRuntimeException ex1 = null;
2578      protocol.readStructBegin();
2579      while (true) {
2580        FieldMetadata field = protocol.readFieldBegin();
2581        if (field.typeId == TType.STOP) {
2582          break;
2583        }
2584        switch (field.fieldId) {
2585          case 0: {
2586            if (field.typeId == TType.LIST) {
2587              ListMetadata listMetadata0 = protocol.readListBegin();
2588              List<FseResult> value = new ArrayList<FseResult>(listMetadata0.size);
2589              for (int i0 = 0; i0 < listMetadata0.size; ++i0) {
2590                net.gdface.sdk.thrift.client.FseResult item0 = net.gdface.sdk.thrift.client.FseResult.ADAPTER.read(protocol);
2591                value.add(item0);
2592              }
2593              protocol.readListEnd();
2594              result = value;
2595            } else {
2596              ProtocolUtil.skip(protocol, field.typeId);
2597            }
2598          }
2599          break;
2600          case 1: {
2601            if (field.typeId == TType.STRUCT) {
2602              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
2603              ex1 = value;
2604            } else {
2605              ProtocolUtil.skip(protocol, field.typeId);
2606            }
2607          }
2608          break;
2609          default: ProtocolUtil.skip(protocol, field.typeId); break;
2610        }
2611        protocol.readFieldEnd();
2612      }
2613      protocol.readStructEnd();
2614      if (result != null) {
2615        return result;
2616      } else if (ex1 != null) {
2617        throw ex1;
2618      } else {
2619        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
2620      }
2621    }
2622  }
2623
2624  private static final class WearMaskCall extends MethodCall<Boolean> {
2625    private final ByteString imgData;
2626
2627    private final CodeInfo faceInfo;
2628
2629    WearMaskCall(ByteString imgData, CodeInfo faceInfo, ServiceMethodCallback<Boolean> callback) {
2630      super("wearMask", TMessageType.CALL, callback);
2631      this.imgData = imgData;
2632      this.faceInfo = faceInfo;
2633    }
2634
2635    @Override
2636    protected void send(Protocol protocol) throws IOException {
2637      protocol.writeStructBegin("args");
2638      if (this.imgData != null) {
2639        protocol.writeFieldBegin("imgData", 1, TType.STRING);
2640        protocol.writeBinary(this.imgData);
2641        protocol.writeFieldEnd();
2642      }
2643      if (this.faceInfo != null) {
2644        protocol.writeFieldBegin("faceInfo", 2, TType.STRUCT);
2645        net.gdface.sdk.thrift.client.CodeInfo.ADAPTER.write(protocol, this.faceInfo);
2646        protocol.writeFieldEnd();
2647      }
2648      protocol.writeFieldStop();
2649      protocol.writeStructEnd();
2650    }
2651
2652    @Override
2653    protected Boolean receive(Protocol protocol, MessageMetadata metadata) throws Exception {
2654      Boolean result = null;
2655      ImageErrorException ex1 = null;
2656      ServiceRuntimeException ex2 = null;
2657      protocol.readStructBegin();
2658      while (true) {
2659        FieldMetadata field = protocol.readFieldBegin();
2660        if (field.typeId == TType.STOP) {
2661          break;
2662        }
2663        switch (field.fieldId) {
2664          case 0: {
2665            if (field.typeId == TType.BOOL) {
2666              boolean value = protocol.readBool();
2667              result = value;
2668            } else {
2669              ProtocolUtil.skip(protocol, field.typeId);
2670            }
2671          }
2672          break;
2673          case 1: {
2674            if (field.typeId == TType.STRUCT) {
2675              net.gdface.sdk.thrift.client.ImageErrorException value = net.gdface.sdk.thrift.client.ImageErrorException.ADAPTER.read(protocol);
2676              ex1 = value;
2677            } else {
2678              ProtocolUtil.skip(protocol, field.typeId);
2679            }
2680          }
2681          break;
2682          case 2: {
2683            if (field.typeId == TType.STRUCT) {
2684              net.gdface.sdk.thrift.client.ServiceRuntimeException value = net.gdface.sdk.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol);
2685              ex2 = value;
2686            } else {
2687              ProtocolUtil.skip(protocol, field.typeId);
2688            }
2689          }
2690          break;
2691          default: ProtocolUtil.skip(protocol, field.typeId); break;
2692        }
2693        protocol.readFieldEnd();
2694      }
2695      protocol.readStructEnd();
2696      if (result != null) {
2697        return result;
2698      } else if (ex1 != null) {
2699        throw ex1;
2700      } else if (ex2 != null) {
2701        throw ex2;
2702      } else {
2703        throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result");
2704      }
2705    }
2706  }
2707}