Java Code Examples for org.apache.hadoop.fs.permission.FsPermission#fromShort()
The following examples show how to use
org.apache.hadoop.fs.permission.FsPermission#fromShort() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FSImageSerialization.java From RDFS with Apache License 2.0 | 5 votes |
static void saveINode2Image(INode node, DataOutputStream out) throws IOException { byte[] name = node.getLocalNameBytes(); out.writeShort(name.length); out.write(name); FsPermission filePerm = TL_DATA.get().FILE_PERM; if (!node.isDirectory()) { // write file inode INodeFile fileINode = (INodeFile)node; out.writeShort(fileINode.getReplication()); out.writeLong(fileINode.getModificationTime()); out.writeLong(fileINode.getAccessTime()); out.writeLong(fileINode.getPreferredBlockSize()); Block[] blocks = fileINode.getBlocks(); out.writeInt(blocks.length); for (Block blk : blocks) blk.write(out); filePerm.fromShort(fileINode.getFsPermissionShort()); PermissionStatus.write(out, fileINode.getUserName(), fileINode.getGroupName(), filePerm); } else { // write directory inode out.writeShort(0); // replication out.writeLong(node.getModificationTime()); out.writeLong(0); // access time out.writeLong(0); // preferred block size out.writeInt(-1); // # of blocks out.writeLong(node.getNsQuota()); out.writeLong(node.getDsQuota()); filePerm.fromShort(node.getFsPermissionShort()); PermissionStatus.write(out, node.getUserName(), node.getGroupName(), filePerm); } }
Example 2
Source File: FSImageSerialization.java From hadoop with Apache License 2.0 | 4 votes |
private static void writePermissionStatus(INodeAttributes inode, DataOutput out) throws IOException { final FsPermission p = TL_DATA.get().FILE_PERM; p.fromShort(inode.getFsPermissionShort()); PermissionStatus.write(out, inode.getUserName(), inode.getGroupName(), p); }
Example 3
Source File: FSImageSerialization.java From big-c with Apache License 2.0 | 4 votes |
private static void writePermissionStatus(INodeAttributes inode, DataOutput out) throws IOException { final FsPermission p = TL_DATA.get().FILE_PERM; p.fromShort(inode.getFsPermissionShort()); PermissionStatus.write(out, inode.getUserName(), inode.getGroupName(), p); }