Example usage for java.lang Short valueOf

List of usage examples for java.lang Short valueOf

Introduction

In this page you can find the example usage for java.lang Short valueOf.

Prototype

public static Short valueOf(String s, int radix) throws NumberFormatException 

Source Link

Document

Returns a Short object holding the value extracted from the specified String when parsed with the radix given by the second argument.

Usage

From source file:Main.java

public static void main(String[] args) {
    System.out.println(Short.valueOf("10", 8));
}

From source file:com.aliyun.odps.volume.VolumeFSUtil.java

/**
 * Transfer {@link VolumeFSFile} to {@link FileStatus}
 * //from  w ww  . ja  v  a2  s.c om
 * @param file
 */
public static FileStatus transferFile(VolumeFSFile file) {
    if (file == null) {
        return null;
    }
    Path symlink = org.apache.commons.lang.StringUtils.isBlank(file.getSymlink()) ? null
            : new Path(file.getSymlink());
    FileStatus fileStatus = new FileStatus(file.getLength(), file.getIsdir(), file.getBlockReplications(),
            file.getBlockSize(), file.getModificationTime().getTime(), file.getAccessTime().getTime(),
            new FsPermission(Short.valueOf(file.getPermission(), 8)), file.getOwner(), file.getGroup(), symlink,
            new Path(VolumeFileSystemConfigKeys.VOLUME_URI_SCHEME + "://" + file.getProject(), file.getPath()));
    return fileStatus;
}

From source file:org.apache.hadoop.hbase.test.IntegrationTestZKAndFSPermissions.java

private void testFSPerms() throws IOException {
    Path rootDir = FSUtils.getRootDir(conf);

    LOG.info("");
    LOG.info("***********************************************************************************");
    LOG.info("Checking FS permissions for root dir:" + rootDir);
    LOG.info("***********************************************************************************");
    LOG.info("");
    FileSystem fs = rootDir.getFileSystem(conf);

    short expectedPerms = Short.valueOf(fsPerms, 8);

    assertEquals(FsPermission.createImmutable(expectedPerms), fs.getFileStatus(rootDir).getPermission());

    LOG.info("Checking FS permissions: SUCCESS");
}