public class

MRUFileManager

extends Object
java.lang.Object
   ↳ org.apache.log4j.lf5.viewer.configure.MRUFileManager

Class Overview

MRUFileManager handles the storage and retrival the most recently opened log files.

Summary

Public Constructors
MRUFileManager()
MRUFileManager(int maxSize)
Public Methods
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.
InputStream getInputStream(int index)
Returns a input stream to the resource at the specified index
String[] getMRUFileList()
Gets the list of files stored in the MRU file list.
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(URL url)
Adds a url to the MRU file list.
void set(File file)
Adds a file name to the MRU file list.
int size()
Gets the size of the MRU file list.
Protected Methods
String getFilename()
InputStream getInputStream(File file)
Gets an input stream for the corresponding file.
InputStream getInputStream(URL url)
Gets an input stream for the corresponding URL.
void load()
Loads the MRU file list in from a file and stores it in a LinkedList.
void setMRU(Object o)
Adds an object to the mru.
void setMaxSize(int maxSize)
Ensures that the MRU list will have a MaxSize.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public MRUFileManager ()

public MRUFileManager (int maxSize)

Public Methods

public static void createConfigurationDirectory ()

Creates the directory where the MRU file list will be written. The "lf5" directory is created in the Documents and Settings directory on Windows 2000 machines and where ever the user.home variable points on all other platforms.

public Object getFile (int index)

Returns a particular file name stored in a MRU file list based on an index value.

public InputStream getInputStream (int index)

Returns a input stream to the resource at the specified index

Throws
FileNotFoundException
IOException

public String[] getMRUFileList ()

Gets the list of files stored in the MRU file list.

public void moveToTop (int index)

Moves the the index to the top of the MRU List

Parameters
index The index to be first in the mru list

public void save ()

Saves a list of MRU files out to a file.

public void set (URL url)

Adds a url to the MRU file list.

public void set (File file)

Adds a file name to the MRU file list.

public int size ()

Gets the size of the MRU file list.

Protected Methods

protected String getFilename ()

protected InputStream getInputStream (File file)

Gets an input stream for the corresponding file.

Parameters
file The file to create the input stream from.
Returns
  • InputStream
Throws
FileNotFoundException
IOException

protected InputStream getInputStream (URL url)

Gets an input stream for the corresponding URL.

Parameters
url The url to create the input stream from.
Returns
  • InputStream
Throws
IOException

protected void load ()

Loads the MRU file list in from a file and stores it in a LinkedList. If no file exists, a new LinkedList is created.

protected void setMRU (Object o)

Adds an object to the mru.

protected void setMaxSize (int maxSize)

Ensures that the MRU list will have a MaxSize.