FileNode.java
net.minecraft.util.filefix.virtualfilesystem.FileNode
信息
- 全限定名:net.minecraft.util.filefix.virtualfilesystem.FileNode
- 类型:final class
- 包:net.minecraft.util.filefix.virtualfilesystem
- 源码路径:src/main/java/net/minecraft/util/filefix/virtualfilesystem/FileNode.java
- 起始行号:L8
- 继承:Node
- 职责:
TODO
字段/常量
-
storagePath- 类型:
Path - 修饰符:
private - 源码定位:
L9 - 说明:
TODO
- 类型:
-
isCopy- 类型:
boolean - 修饰符:
package-private - 源码定位:
L10 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
FileNode(CopyOnWriteFSPath path, Path storagePath, boolean isCopy) @ L12
- 构造器名:FileNode
- 源码定位:L12
- 修饰符:package-private
参数:
- path: CopyOnWriteFSPath
- storagePath: Path
- isCopy: boolean
说明:
TODO
方法
下面的方法块按源码顺序生成。
public void ensureCopy() @ L18
- 方法名:ensureCopy
- 源码定位:L18
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public void deleteCopy() @ L27
- 方法名:deleteCopy
- 源码定位:L27
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public Path storagePath() @ L33
- 方法名:storagePath
- 源码定位:L33
- 返回类型:Path
- 修饰符:public
参数:
- 无
说明:
TODO
代码
final class FileNode extends Node {
private Path storagePath;
boolean isCopy;
FileNode(CopyOnWriteFSPath path, Path storagePath, boolean isCopy) {
super(path);
this.storagePath = storagePath;
this.isCopy = isCopy;
}
public void ensureCopy() throws IOException {
if (!this.isCopy) {
Path tempFile = this.path.getFileSystem().createTemporaryFilePath();
Files.copy(this.storagePath, tempFile, StandardCopyOption.COPY_ATTRIBUTES);
this.storagePath = tempFile;
this.isCopy = true;
}
}
public void deleteCopy() throws IOException {
if (this.isCopy) {
Files.deleteIfExists(this.storagePath);
}
}
public Path storagePath() {
return this.storagePath;
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
继承
- 引用位置: