com.mucommander.io
Class BufferPool.BufferFactory

java.lang.Object
  extended by com.mucommander.io.BufferPool.BufferFactory
Direct Known Subclasses:
BufferPool.ByteArrayFactory, BufferPool.ByteBufferFactory, BufferPool.CharArrayFactory
Enclosing class:
BufferPool

public abstract static class BufferPool.BufferFactory
extends java.lang.Object

A BufferFactory is responsible for creating buffer and BufferPool.BufferContainer instances, and for returning the buffer Class. The Class returned by getBufferClass() may be a superclass or superinterface of the actual objects returned by newBuffer(int).


Constructor Summary
BufferPool.BufferFactory()
           
 
Method Summary
protected abstract  java.lang.Class getBufferClass()
          Returns the Class of buffer instances this factory creates.
protected  boolean matchesBufferClass(java.lang.Class bufferClass)
          Returns true if the class returned by getBufferClass() is equal or a superclass/superinterface of the specified buffer class.
protected abstract  java.lang.Object newBuffer(int size)
          Creates and returns a buffer instance of the specified size.
protected abstract  BufferPool.BufferContainer newBufferContainer(java.lang.Object buffer)
          Creates and returns a BufferPool.BufferContainer for the specified buffer instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferPool.BufferFactory

public BufferPool.BufferFactory()
Method Detail

matchesBufferClass

protected boolean matchesBufferClass(java.lang.Class bufferClass)
Returns true if the class returned by getBufferClass() is equal or a superclass/superinterface of the specified buffer class.

Parameters:
bufferClass - the buffer Class to test
Returns:
true if the class returned by #getBufferClass() is equal or a superclass/superinterface of the specified buffer class

newBuffer

protected abstract java.lang.Object newBuffer(int size)
Creates and returns a buffer instance of the specified size.

Parameters:
size - size of the buffer to create
Returns:
a buffer instance of the specified size

newBufferContainer

protected abstract BufferPool.BufferContainer newBufferContainer(java.lang.Object buffer)
Creates and returns a BufferPool.BufferContainer for the specified buffer instance.

Parameters:
buffer - the buffer to wrap in a BufferContainer
Returns:
returns a BufferContainer for the specified buffer instance

getBufferClass

protected abstract java.lang.Class getBufferClass()
Returns the Class of buffer instances this factory creates.

Returns:
the Class of buffer instances this factory creates


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard