Code example for DataInput

Methods: readBooleanreadUTF

0
    this.authMethod = authMethod;
  } 
 
  @Override 
  public void readFields(DataInput in) throws IOException {
    protocol = Text.readString(in);
    if (protocol.isEmpty()) {
      protocol = null;
    } 
     
    boolean ugiUsernamePresent = in.readBoolean();
    if (ugiUsernamePresent) {
      String username = in.readUTF();
      boolean realUserNamePresent = in.readBoolean();
      if (realUserNamePresent) {
        String realUserName = in.readUTF();
        UserGroupInformation realUserUgi = UserGroupInformation
            .createRemoteUser(realUserName);
        ugi = UserGroupInformation.createProxyUser(username, realUserUgi);
      } else { 
      	ugi = UserGroupInformation.createRemoteUser(username);