ntfsindexentry.java

来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 117 行

JAVA
117
字号
/*
 * $Id: NTFSIndexEntry.java,v 1.6 2004/01/19 19:02:23 vchira_2000 Exp $
 */
package org.jnode.fs.ntfs.attributes;

import org.jnode.fs.ntfs.NTFSFileRecord;
import org.jnode.fs.ntfs.NTFSUTIL;

/**
 * @author vali
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class NTFSIndexEntry {
	
	private NTFSFileRecord parentFileRecord = null;

	private byte[] buffer = null;

	public NTFSIndexEntry(NTFSFileRecord parentFileRecord,byte[] buffer)
	{
			this.parentFileRecord = parentFileRecord;
			this.buffer = buffer;
	}

	public int getFileNameLength()
	{
		return buffer[0x50];
	}
	
	public char[] getFileNameAsCharArray()
	{
		char[] name = new char[getFileNameLength()];
		for(int i = 0;i < getFileNameLength();i++)
		{
			name[i] = NTFSUTIL.READ16_CHAR(
					buffer[0x52 + (i*2)],
					buffer[0x52 + (i*2) + 1]
			);
		}
		return name;
	}

	public boolean hasSubNodes()
	{
		return (buffer[0x0C] & 0x01) != 0;
	}
	public boolean isLastIndexEntryInSubnode()
	{
		return (buffer[0x0C] & 0x02) != 0;
	}
	public byte getNameSpace()
	{
		return buffer[0x51];
	}
	public boolean isDirectory()
	{
		return (NTFSUTIL.LE_READ_U32_INT(buffer,0x48) & 0x10000000) != 0;
	}

	
	public String getFileName()
	{
		return new String(this.getFileNameAsCharArray());
	}
	
	public  int getFileReferenceNumber()
	{
		return NTFSUTIL.LE_READ_U48_INT(buffer,0x00);
	}
 
	public long getFileFlags()
	{
		return NTFSUTIL.LE_READ_U64_LONG(buffer,0x48);
	}
	
	public long getRealFileSize()
	{
		return NTFSUTIL.LE_READ_U64_LONG(buffer,0x40);
	} 
	/**
	 * @return Returns the parentFileRecord.
	 */
	public NTFSFileRecord getParentFileRecord()
	{
		return parentFileRecord;
	}
	/**
	 * @param parentFileRecord The parentFileRecord to set.
	 */
	public void setParentFileRecord(NTFSFileRecord parentFileRecord)
	{
		this.parentFileRecord = parentFileRecord;
	}
	/**
	 * @return Returns the buffer.
	 */
	public byte[] getBuffer() {
		return this.buffer;
	}

	/**
	 * @param buffer The buffer to set.
	 */
	public void setBuffer(byte[] buffer) {
		this.buffer = buffer;
	}

	public long getSubnodeVCN()
	{
		return NTFSUTIL.LE_READ_U32_INT(
				buffer,
				buffer.length - 8);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?