當前位置: 首頁>>代碼示例>>Java>>正文


Java FsPermission.valueOf方法代碼示例

本文整理匯總了Java中org.apache.hadoop.fs.permission.FsPermission.valueOf方法的典型用法代碼示例。如果您正苦於以下問題:Java FsPermission.valueOf方法的具體用法?Java FsPermission.valueOf怎麽用?Java FsPermission.valueOf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.fs.permission.FsPermission的用法示例。


在下文中一共展示了FsPermission.valueOf方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: flush

import org.apache.hadoop.fs.permission.FsPermission; //導入方法依賴的package包/類
@Override
public void flush() throws IOException {
  super.flush();
  if (LOG.isDebugEnabled()) {
    LOG.debug("Reseting permissions to '" + permissions + "'");
  }
  if (!Shell.WINDOWS) {
    Files.setPosixFilePermissions(Paths.get(file.getCanonicalPath()),
        permissions);
  } else {
    // FsPermission expects a 10-character string because of the leading
    // directory indicator, i.e. "drwx------". The JDK toString method returns
    // a 9-character string, so prepend a leading character.
    FsPermission fsPermission = FsPermission.valueOf(
        "-" + PosixFilePermissions.toString(permissions));
    FileUtil.setPermission(file, fsPermission);
  }
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:19,代碼來源:LocalJavaKeyStoreProvider.java

示例2: testCompareTo

import org.apache.hadoop.fs.permission.FsPermission; //導入方法依賴的package包/類
@Test
public void testCompareTo() throws IOException {
  Path path1 = new Path("path1");
  Path path2 = new Path("path2");
  FileStatus fileStatus1 =
      new FileStatus(1, true, 1, 1, 1, 1, FsPermission.valueOf("-rw-rw-rw-"),
          "one", "one", null, path1);
  FileStatus fileStatus2 =
      new FileStatus(1, true, 1, 1, 1, 1, FsPermission.valueOf("-rw-rw-rw-"),
          "one", "one", null, path2);
  assertTrue(fileStatus1.compareTo(fileStatus2) < 0);
  assertTrue(fileStatus2.compareTo(fileStatus1) > 0);

  List<FileStatus> statList = new ArrayList<>();
  statList.add(fileStatus1);
  statList.add(fileStatus2);
  assertTrue(Collections.binarySearch(statList, fileStatus1) > -1);
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:19,代碼來源:TestFileStatus.java

示例3: testEquals

import org.apache.hadoop.fs.permission.FsPermission; //導入方法依賴的package包/類
/**
 * Check that FileStatus are equal if their paths are equal.
 */
@Test
public void testEquals() {
  Path path = new Path("path");
  FileStatus fileStatus1 = new FileStatus(1, true, 1, 1, 1, 1,
      FsPermission.valueOf("-rw-rw-rw-"), "one", "one", null, path);
  FileStatus fileStatus2 = new FileStatus(2, true, 2, 2, 2, 2,
      FsPermission.valueOf("---x--x--x"), "two", "two", null, path);
  assertEquals(fileStatus1, fileStatus2);
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:13,代碼來源:TestFileStatus.java

示例4: testNotEquals

import org.apache.hadoop.fs.permission.FsPermission; //導入方法依賴的package包/類
/**
 * Check that FileStatus are not equal if their paths are not equal.
 */
@Test
public void testNotEquals() {
  Path path1 = new Path("path1");
  Path path2 = new Path("path2");
  FileStatus fileStatus1 = new FileStatus(1, true, 1, 1, 1, 1,
      FsPermission.valueOf("-rw-rw-rw-"), "one", "one", null, path1);
  FileStatus fileStatus2 = new FileStatus(1, true, 1, 1, 1, 1,
      FsPermission.valueOf("-rw-rw-rw-"), "one", "one", null, path2);
  assertFalse(fileStatus1.equals(fileStatus2));
  assertFalse(fileStatus2.equals(fileStatus1));
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:15,代碼來源:TestFileStatus.java

示例5: startElement

import org.apache.hadoop.fs.permission.FsPermission; //導入方法依賴的package包/類
@Override
public void startElement(String ns, String localname, String qname,
            Attributes attrs) throws SAXException {
  if ("listing".equals(qname)) return;
  if (!"file".equals(qname) && !"directory".equals(qname)) {
    if (RemoteException.class.getSimpleName().equals(qname)) {
      throw new SAXException(RemoteException.valueOf(attrs));
    }
    throw new SAXException("Unrecognized entry: " + qname);
  }
  long modif;
  long atime = 0;
  try {
    final SimpleDateFormat ldf = df.get();
    modif = ldf.parse(attrs.getValue("modified")).getTime();
    String astr = attrs.getValue("accesstime");
    if (astr != null) {
      atime = ldf.parse(astr).getTime();
    }
  } catch (ParseException e) { throw new SAXException(e); }
  FileStatus fs = "file".equals(qname)
    ? new FileStatus(
          Long.parseLong(attrs.getValue("size")), false,
          Short.valueOf(attrs.getValue("replication")).shortValue(),
          Long.parseLong(attrs.getValue("blocksize")),
          modif, atime, FsPermission.valueOf(attrs.getValue("permission")),
          attrs.getValue("owner"), attrs.getValue("group"),
          HftpFileSystem.this.makeQualified(
              new Path(getUri().toString(), attrs.getValue("path"))))
    : new FileStatus(0L, true, 0, 0L,
          modif, atime, FsPermission.valueOf(attrs.getValue("permission")),
          attrs.getValue("owner"), attrs.getValue("group"),
          HftpFileSystem.this.makeQualified(
              new Path(getUri().toString(), attrs.getValue("path"))));
  fslist.add(fs);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:37,代碼來源:HftpFileSystem.java

示例6: fromJSONMap

import org.apache.hadoop.fs.permission.FsPermission; //導入方法依賴的package包/類
private static PermissionStatus fromJSONMap(
    @SuppressWarnings("rawtypes") Map object) {
  return new PermissionStatus((String) object.get(OWNER_TAG),
      (String) object.get(GROUP_TAG),
      // The initial - below is the Unix file type,
      // which FsPermission needs there but ignores.
      FsPermission.valueOf("-" + (String) object.get(PERMISSIONS_TAG)));
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:9,代碼來源:AzureNativeFileSystemStore.java

示例7: flush

import org.apache.hadoop.fs.permission.FsPermission; //導入方法依賴的package包/類
@Override
public void flush() throws IOException {
  super.flush();
  if (!Shell.WINDOWS) {
    Files.setPosixFilePermissions(Paths.get(file.getCanonicalPath()),
        permissions);
  } else {
    // FsPermission expects a 10-character string because of the leading
    // directory indicator, i.e. "drwx------". The JDK toString method returns
    // a 9-character string, so prepend a leading character.
    FsPermission fsPermission = FsPermission.valueOf(
        "-" + PosixFilePermissions.toString(permissions));
    FileUtil.setPermission(file, fsPermission);
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:16,代碼來源:LocalJavaKeyStoreProvider.java


注:本文中的org.apache.hadoop.fs.permission.FsPermission.valueOf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。