当前位置: 首页>>代码示例>>Java>>正文


Java XDR.writeString方法代码示例

本文整理汇总了Java中org.apache.hadoop.oncrpc.XDR.writeString方法的典型用法代码示例。如果您正苦于以下问题:Java XDR.writeString方法的具体用法?Java XDR.writeString怎么用?Java XDR.writeString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.oncrpc.XDR的用法示例。


在下文中一共展示了XDR.writeString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: write

import org.apache.hadoop.oncrpc.XDR; //导入方法依赖的package包/类
@Override
public void write(XDR xdr) {
  // mStamp + mHostName.length + mHostName + mUID + mGID + mAuxGIDs.count
  mCredentialsLength = 20 + mHostName.getBytes(Charsets.UTF_8).length;
  // mAuxGIDs
  if (mAuxGIDs != null && mAuxGIDs.length > 0) {
    mCredentialsLength += mAuxGIDs.length * 4;
  }
  xdr.writeInt(mCredentialsLength);
  
  xdr.writeInt(mStamp);
  xdr.writeString(mHostName);
  xdr.writeInt(mUID);
  xdr.writeInt(mGID);
  
  if((mAuxGIDs == null) || (mAuxGIDs.length == 0)) {
    xdr.writeInt(0);
  } else {
    xdr.writeInt(mAuxGIDs.length);
    for (int i = 0; i < mAuxGIDs.length; i++) {
      xdr.writeInt(mAuxGIDs[i]);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:CredentialsSys.java

示例2: writeExportList

import org.apache.hadoop.oncrpc.XDR; //导入方法依赖的package包/类
/** Response for RPC call {@link MountInterface.MNTPROC#EXPORT} */
public static XDR writeExportList(XDR xdr, int xid, List<String> exports,
    List<NfsExports> hostMatcher) {
  assert (exports.size() == hostMatcher.size());

  RpcAcceptedReply.getAcceptInstance(xid, new VerifierNone()).write(xdr);
  for (int i = 0; i < exports.size(); i++) {
    xdr.writeBoolean(true); // Value follows - yes
    xdr.writeString(exports.get(i));

    // List host groups
    String[] hostGroups = hostMatcher.get(i).getHostGroupList();
    if (hostGroups.length > 0) {
      for (int j = 0; j < hostGroups.length; j++) {
        xdr.writeBoolean(true); // Value follows - yes
        xdr.writeVariableOpaque(hostGroups[j].getBytes(Charsets.UTF_8));
      }
    }
    xdr.writeBoolean(false); // Value follows - no more group
  }
  
  xdr.writeBoolean(false); // Value follows - no
  return xdr;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:MountResponse.java

示例3: testClientAccessPrivilegeForRemove

import org.apache.hadoop.oncrpc.XDR; //导入方法依赖的package包/类
@Test(timeout = 60000)
public void testClientAccessPrivilegeForRemove() throws Exception {
  // Configure ro access for nfs1 service
  config.set("dfs.nfs.exports.allowed.hosts", "* ro");

  // Start nfs
  Nfs3 nfs = new Nfs3(config);
  nfs.startServiceInternal(false);

  RpcProgramNfs3 nfsd = (RpcProgramNfs3) nfs.getRpcProgram();

  // Create a remove request
  HdfsFileStatus status = nn.getRpcServer().getFileInfo(testdir);
  long dirId = status.getFileId();

  XDR xdr_req = new XDR();
  FileHandle handle = new FileHandle(dirId);
  handle.serialize(xdr_req);
  xdr_req.writeString("f1");

  // Remove operation
  REMOVE3Response response = nfsd.remove(xdr_req.asReadOnlyWrap(),
      securityHandler, new InetSocketAddress("localhost", 1234));

  // Assert on return code
  assertEquals("Incorrect return code", Nfs3Status.NFS3ERR_ACCES,
      response.getStatus());

}
 
开发者ID:naver,项目名称:hadoop,代码行数:30,代码来源:TestClientAccessPrivilege.java

示例4: writeMountList

import org.apache.hadoop.oncrpc.XDR; //导入方法依赖的package包/类
/** Response for RPC call {@link MountInterface.MNTPROC#DUMP} */
public static XDR writeMountList(XDR xdr, int xid, List<MountEntry> mounts) {
  RpcAcceptedReply.getAcceptInstance(xid, new VerifierNone()).write(xdr);
  for (MountEntry mountEntry : mounts) {
    xdr.writeBoolean(true); // Value follows yes
    xdr.writeString(mountEntry.getHost());
    xdr.writeString(mountEntry.getPath());
  }
  xdr.writeBoolean(false); // Value follows no
  return xdr;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:MountResponse.java

示例5: seralize

import org.apache.hadoop.oncrpc.XDR; //导入方法依赖的package包/类
void seralize(XDR xdr) {
  xdr.writeLongAsHyper(fileId);
  xdr.writeString(name);
  xdr.writeLongAsHyper(cookie);
  xdr.writeBoolean(true);
  nameAttr.serialize(xdr);
  xdr.writeBoolean(true);
  objFileHandle.serialize(xdr);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:READDIRPLUS3Response.java

示例6: seralize

import org.apache.hadoop.oncrpc.XDR; //导入方法依赖的package包/类
void seralize(XDR xdr) {
  xdr.writeLongAsHyper(getFileId());
  xdr.writeString(getName());
  xdr.writeLongAsHyper(getCookie());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:6,代码来源:READDIR3Response.java


注:本文中的org.apache.hadoop.oncrpc.XDR.writeString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。