INodeFile extends INodeWithAdditionalFields implements BlockCollection { public static INodeFile valueOf(INode inode, String path ) throws FileNotFoundException, StorageException, TransactionContextException { return valueOf(inode, path, false); } INodeFile(long id, PermissionStatus permissions, BlockInfoContiguous[] blklist,
      short replication, long modificationTime, long atime,
      long preferredBlockSize, byte storagePolicyID);  INodeFile(long id, PermissionStatus permissions, BlockInfoContiguous[] blklist,
      short replication, long modificationTime, long atime,
      long preferredBlockSize, byte storagePolicyID, boolean inTree);  INodeFile(long id, PermissionStatus permissions, long header,
      long modificationTime, long atime, boolean isFileStoredInDB, byte storagepolicy, boolean inTree);  INodeFile(INodeFile other); static INodeFile valueOf(INode inode, String path
      ); static INodeFile valueOf(INode inode, String path, boolean acceptNull); @Override final boolean isFile(); @Override final INodeFile asFile(); final FileUnderConstructionFeature getFileUnderConstructionFeature(); @Override // BlockCollection boolean isUnderConstruction(); @Override short getBlockReplication(); @Override byte getStoragePolicyID(); @Override long getPreferredBlockSize(); @Override BlockInfoContiguous getBlock(int index); @Override BlockInfoContiguous[] getBlocks(); void storeFileDataInDB(byte[] data); byte[] getFileDataInDB(); void deleteFileDataStoredInDB(); void setBlock(int idx, BlockInfoContiguous blk); @Override void destroyAndCollectBlocks(BlockStoragePolicySuite bsps,
      BlocksMapUpdateInfo collectedBlocks, final List<INode> removedINodes); @Override String getName(); @Override final ContentSummaryComputationContext computeContentSummary(
      final ContentSummaryComputationContext summary); final long computeFileSizeNotIncludingLastUcBlock(); long computeFileSize(); final long computeFileSize(boolean includesLastUcBlock,
      boolean usePreferredBlockSize4LastUcBlock); final long storagespaceConsumed(); final long storagespaceConsumedNoReplication(); @Override BlockInfoContiguous getLastBlock(); @Override int numBlocks(); INodeFile toUnderConstruction(String clientName, String clientMachine); INodeFile toCompleteFile(long mtime); @Override BlockInfoContiguousUnderConstruction setLastBlock(
      BlockInfoContiguous lastBlock, DatanodeStorageInfo[] locations); void removeBlock(BlockInfoContiguous block); BlockInfoContiguous findMaxBlk(); int getGenerationStamp(); void setGenerationStampNoPersistence(int generationStamp); int nextGenerationStamp(); long getSize(); boolean isFileStoredInDB(); void setFileStoredInDB(boolean isFileStoredInDB); void setFileStoredInDBNoPersistence(boolean isFileStoredInDB); void setSizeNoPersistence(long size); void setSize(long size); void recomputeFileSize(); @Override INode cloneInode(); long collectBlocksBeyondMax(final long max,
      final BlocksMapUpdateInfo collectedBlocks);  }
@Test public void testValueOf() throws IOException { final String path = "/testValueOf"; final PermissionStatus perm = new PermissionStatus(userName, null, FsPermission.getDefault()); final short replication = 3; { final INode from = null; try { INodeFile.valueOf(from, path); fail(); } catch (FileNotFoundException fnfe) { assertTrue(fnfe.getMessage().contains("File does not exist")); } try { INodeDirectory.valueOf(from, path); fail(); } catch (FileNotFoundException e) { assertTrue(e.getMessage().contains("Directory does not exist")); } } { final INode from = new INodeFile(0, perm, null, replication, 0L, 0L, preferredBlockSize, (byte) 0); final INodeFile f = INodeFile.valueOf(from, path); assertTrue(f == from); try { INodeDirectory.valueOf(from, path); fail(); } catch(PathIsNotDirectoryException expected) { } } { final INode from = new INodeFile(HdfsConstantsClient.GRANDFATHER_INODE_ID, perm, BlockInfoContiguous.EMPTY_ARRAY, replication, 0L, 0L, preferredBlockSize, (byte) 0); final INodeFile f = INodeFile.valueOf(from, path); assertTrue(f == from); try { INodeDirectory.valueOf(from, path); fail(); } catch (PathIsNotDirectoryException e) { } } { final INode from = new INodeDirectory(HdfsConstantsClient.GRANDFATHER_INODE_ID, perm, 0L); try { INodeFile.valueOf(from, path); fail(); } catch (FileNotFoundException fnfe) { assertTrue(fnfe.getMessage().contains("Path is not a file")); } final INodeDirectory d = INodeDirectory.valueOf(from, path); assertTrue(d == from); } }