- java.lang.Object
-
- com.kttdevelopment.simplehttpserver.handler.CacheFileAdapter
-
- All Implemented Interfaces:
FileHandlerAdapter
public class CacheFileAdapter extends Object implements FileHandlerAdapter
This class caches file bytes when adding to theFileHandler. Only works for files withe theByteLoadingOption.CACHELOADoption.- Since:
- 4.0.0
- Version:
- 4.0.0
- Author:
- Ktt Development
- See Also:
FileHandlerAdapter,FileHandler
-
-
Constructor Summary
Constructors Constructor Description CacheFileAdapter(long cacheTimeMillis)Creates a CacheFileAdapter where files will expire after set milliseconds.CacheFileAdapter(long cacheTime, TimeUnit timeUnit)Creates a CacheFileAdapter where files will expire after a set time.
-
Method Summary
All Methods Instance Methods Concrete Methods Default Methods Modifier and Type Method Description default byte[]getBytes(File file, byte[] bytes)Returns the bytes when given a file and its initial contentsdefault StringgetName(File file)Returns the name when given a file.StringtoString()
-
-
-
Method Detail
-
getName
public default String getName(File file)
Returns the name when given a file.- Parameters:
file- file to name- Returns:
- new name
- Since:
- 01.00.00
-
getBytes
public default byte[] getBytes(File file, byte[] bytes)
Returns the bytes when given a file and its initial contents- Parameters:
file- file to namebytes- bytes from preload- Returns:
- new bytes
- Since:
- 01.00.00
-
-