All Downloads are FREE. Search and download functionalities are using the official Maven repository.

convex.dlfs.impl.DLFSFileAttributes Maven / Gradle / Ivy

The newest version!
package convex.dlfs.impl;

import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileTime;

import convex.core.data.ABlob;
import convex.core.data.ACell;
import convex.core.data.AVector;
import convex.dlfs.DLFSNode;

public class DLFSFileAttributes implements BasicFileAttributes {

	private AVector node;

	public DLFSFileAttributes(AVector node) {
		this.node=node;
	}

	public static DLFSFileAttributes create(AVector node) {
		return new DLFSFileAttributes(node);
	}
	
	@Override
	public FileTime lastModifiedTime() {
		return getFileTime();
	}

	protected FileTime getFileTime() {
		return FileTime.fromMillis(DLFSNode.getUTime(node).longValue());
	}

	@Override
	public FileTime lastAccessTime() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public FileTime creationTime() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean isRegularFile() {
		return DLFSNode.isRegularFile(node);
	}

	@Override
	public boolean isDirectory() {
		return DLFSNode.isDirectory(node);
	}

	@Override
	public boolean isSymbolicLink() {
		return false;
	}

	@Override
	public boolean isOther() {
		return DLFSNode.isTombstone(node);
	}

	@Override
	public long size() {
		ABlob blob=DLFSNode.getData(node);
		if (blob!=null) return blob.count();
		return 0;
	}

	@Override
	public Object fileKey() {
		// TODO Auto-generated method stub
		return null;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy