FileDocCategorySizeDatePackage
CacheEntry.javaAPI DocAzureus 3.0.3.43064Thu Feb 09 19:42:58 GMT 2006com.aelitis.azureus.core.diskmanager.cache.impl

CacheEntry

public class CacheEntry extends Object
author
parg

Fields Summary
protected static final int
CT_DATA_WRITE
protected static final int
CT_READ_AHEAD
protected CacheFileWithCache
file
protected DirectByteBuffer
buffer
protected long
offset
protected int
size
protected int
buffer_pos
protected int
buffer_limit
protected boolean
dirty
protected long
last_used
protected int
entry_type
protected int
usage_count
Constructors Summary
protected CacheEntry(int _entry_type, CacheFileWithCache _file, DirectByteBuffer _buffer, long _offset, int _size)

	
	
	
							
				
			
						
							 
	
		entry_type	= _entry_type;
		file		= _file;
		buffer		= _buffer;
		offset		= _offset;
		size		= _size;
		
		buffer_pos		= buffer.position(DirectByteBuffer.SS_CACHE);
		buffer_limit	= buffer.limit(DirectByteBuffer.SS_CACHE);
		
		if ( size != buffer_limit - buffer_pos ){
			
			Debug.out( "CacheEntry: initial size incorrect - size =" + size + ", pos = " + buffer_pos + ", lim = " + buffer_limit );
		}
		
		dirty		= true;
		last_used	= SystemTime.getCurrentTime();
	
Methods Summary
public DirectByteBuffergetBuffer()

		return( buffer );
	
public CacheFileWithCachegetFile()

	
		return( file );
	
public longgetFilePosition()

		return( offset );
	
protected longgetLastUsed()

		return( last_used );
	
public intgetLength()

		return( size );
	
protected java.lang.StringgetString()

		return( "[" + offset + " - " + (offset+size-1) + ":" + buffer.position(DirectByteBuffer.SS_CACHE)+"/"+buffer.limit(DirectByteBuffer.SS_CACHE)+"]" );
	
protected intgetType()

		return( entry_type );
	
protected intgetUsageCount()

		return( usage_count );
	
public booleanisDirty()

		return( dirty );
	
protected voidresetBufferPosition()

		buffer.position( DirectByteBuffer.SS_CACHE, buffer_pos );
	
public voidsetClean()

		dirty	= false;
	
protected voidused()

		last_used = SystemTime.getCurrentTime();
		
		usage_count++;