public class MRUFileManager extends Object
MRUFileManager handles the storage and retrival the most recently opened log files.
Modifier and Type | Field and Description |
---|---|
private int |
_maxSize |
private LinkedList |
_mruFileList |
private static String |
CONFIG_FILE_NAME |
private static int |
DEFAULT_MAX_SIZE |
Constructor and Description |
---|
MRUFileManager() |
MRUFileManager(int maxSize) |
Modifier and Type | Method and Description |
---|---|
static void |
createConfigurationDirectory()
Creates the directory where the MRU file list will be written.
|
Object |
getFile(int index)
Returns a particular file name stored in a MRU file
list based on an index value.
|
protected String |
getFilename() |
protected InputStream |
getInputStream(File file)
Gets an input stream for the corresponding file.
|
InputStream |
getInputStream(int index)
Returns a input stream to the resource at the specified index
|
protected InputStream |
getInputStream(URL url)
Gets an input stream for the corresponding URL.
|
String[] |
getMRUFileList()
Gets the list of files stored in the MRU file list.
|
protected void |
load()
Loads the MRU file list in from a file and stores it in a LinkedList.
|
void |
moveToTop(int index)
Moves the the index to the top of the MRU List
|
void |
save()
Saves a list of MRU files out to a file.
|
void |
set(File file)
Adds a file name to the MRU file list.
|
void |
set(URL url)
Adds a url to the MRU file list.
|
protected void |
setMaxSize(int maxSize)
Ensures that the MRU list will have a MaxSize.
|
protected void |
setMRU(Object o)
Adds an object to the mru.
|
int |
size()
Gets the size of the MRU file list.
|
private static final String CONFIG_FILE_NAME
private static final int DEFAULT_MAX_SIZE
private int _maxSize
private LinkedList _mruFileList
public MRUFileManager()
public MRUFileManager(int maxSize)
public void save()
public int size()
public Object getFile(int index)
public InputStream getInputStream(int index) throws IOException, FileNotFoundException
IOException
FileNotFoundException
public String[] getMRUFileList()
public void moveToTop(int index)
index
- The index to be first in the mru listpublic static void createConfigurationDirectory()
protected InputStream getInputStream(File file) throws IOException, FileNotFoundException
file
- The file to create the input stream from.IOException
FileNotFoundException
protected InputStream getInputStream(URL url) throws IOException
url
- The url to create the input stream from.IOException
protected void load()
protected String getFilename()
protected void setMaxSize(int maxSize)
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses