java.lang.Object
org.codelibs.jcifs.smb.impl.BufferCacheImpl
- All Implemented Interfaces:
BufferCache
Cache for reusable byte buffers
This class is intended for internal use.
-
Constructor Summary
ConstructorsConstructorDescriptionBufferCacheImpl(int maxBuffers, int maxSize) Constructs a buffer cache with specified parameters.Constructs a buffer cache using configuration settings. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Gets a buffer from the cache or creates a new one if the cache is empty.voidreleaseBuffer(byte[] buf) Return a buffer to the cache
-
Constructor Details
-
BufferCacheImpl
Constructs a buffer cache using configuration settings.- Parameters:
cfg- the configuration to use for buffer cache settings
-
BufferCacheImpl
public BufferCacheImpl(int maxBuffers, int maxSize) Constructs a buffer cache with specified parameters.- Parameters:
maxBuffers- the maximum number of buffers to cachemaxSize- the size of each buffer in bytes
-
-
Method Details
-
getBuffer
public byte[] getBuffer()Gets a buffer from the cache or creates a new one if the cache is empty.- Specified by:
getBufferin interfaceBufferCache- Returns:
- a buffer from the cache, or a new one
- See Also:
-
releaseBuffer
public void releaseBuffer(byte[] buf) Return a buffer to the cache- Specified by:
releaseBufferin interfaceBufferCache- Parameters:
buf- the buffer to return to the cache for reuse- See Also:
-