/** * A copy constructor. All the fields are copied from the copied {@code igfsFile}, but the {@code groupBlockSize} * which is specified separately. * * @param igfsFile The file to copy. * @param grpBlockSize Group block size. */ public IgfsFileImpl(IgfsFile igfsFile, long grpBlockSize) { A.notNull(igfsFile, "igfsFile"); this.path = igfsFile.path(); this.fileId = igfsFile instanceof IgfsFileImpl ? ((IgfsFileImpl)igfsFile).fileId : IgniteUuid.randomUuid(); this.blockSize = igfsFile.blockSize(); this.len = igfsFile.length(); this.grpBlockSize = igfsFile.isFile() ? grpBlockSize : 0L; this.props = igfsFile.properties(); this.accessTime = igfsFile.accessTime(); this.modificationTime = igfsFile.modificationTime(); this.flags = IgfsUtils.flags(igfsFile.isDirectory(), igfsFile.isFile()); }
assert igfs.info(new IgfsPath("/r")).isFile(); assert igfs.info(new IgfsPath("/k/l")).isFile(); assert igfs.info(new IgfsPath("/k/l")).isFile(); assert igfs.info(new IgfsPath("/k/l")).isFile(); assert igfs.info(new IgfsPath("/k/l")).isFile(); assert igfs.info(new IgfsPath("/x/y/f")).isFile(); assert igfs.info(new IgfsPath("/x/y/z/f")).isFile(); assert igfs.info(new IgfsPath("/x/y/z/t/f")).isFile(); assert igfs.info(new IgfsPath("/x/y/z/t/t2/t3/t4/t5/f")).isFile();
assertEquals("Type", true, desc.isFile()); assertEquals("Type", false, desc.isDirectory());
assertTrue(igfs.info(new IgfsPath("/d/f")).isFile());
assert igfs.info(new IgfsPath("/k/l")).isFile(); assert igfs.info(new IgfsPath("/k/l")).isFile(); assert igfs.info(new IgfsPath("/k/l")).isFile(); assert igfs.info(new IgfsPath("/x/y/f")).isFile(); assert igfs.info(new IgfsPath("/x/y/z/f")).isFile(); assert igfs.info(new IgfsPath("/x/y/z/t/f")).isFile(); assert igfs.info(new IgfsPath("/x/y/z/t/t2/t3/t4/t5/f")).isFile();
throw new IgfsPathNotFoundException("File not found: " + path); if (!info.isFile()) throw new IgfsPathIsDirectoryException("Failed to open file (not a file): " + path);
/** * A copy constructor. All the fields are copied from the copied {@code igfsFile}, but the {@code groupBlockSize} * which is specified separately. * * @param igfsFile The file to copy. * @param grpBlockSize Group block size. */ public IgfsFileImpl(IgfsFile igfsFile, long grpBlockSize) { A.notNull(igfsFile, "igfsFile"); this.path = igfsFile.path(); this.fileId = igfsFile instanceof IgfsFileImpl ? ((IgfsFileImpl)igfsFile).fileId : IgniteUuid.randomUuid(); this.blockSize = igfsFile.blockSize(); this.len = igfsFile.length(); this.grpBlockSize = igfsFile.isFile() ? grpBlockSize : 0L; this.props = igfsFile.properties(); this.accessTime = igfsFile.accessTime(); this.modificationTime = igfsFile.modificationTime(); this.flags = IgfsUtils.flags(igfsFile.isDirectory(), igfsFile.isFile()); }
throw new IgfsPathNotFoundException("File not found: " + path); if (!info.isFile()) throw new IgfsPathIsDirectoryException("Failed to open file (not a file): " + path);