MRUFileManager (Apache Log4j 1.2.17 API)
Date: 2012-05-06

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.log4j.lf5.viewer.configure
Class MRUFileManager

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

    public class MRUFileManager

extends Object

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

Author:
  Brad Marlborough, Richard Hurst

Constructor Summary
`MRUFileManager()`
`MRUFileManager(int maxSize)`

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MRUFileManager

    public MRUFileManager()

### MRUFileManager

    public MRUFileManager(int maxSize)

Method Detail

### save

    public void save()

  Saves a list of MRU files out to a file.

### size

    public int size()

  Gets the size of the MRU file list.

### getFile

    public Object getFile(int index)

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

### getInputStream

    public InputStream getInputStream(int index)
                               throws IOException,
                                      FileNotFoundException

  Returns a input stream to the resource at the specified index

  Throws:
    `IOException`
    `FileNotFoundException`

### set

    public void set(File file)

  Adds a file name to the MRU file list.

### set

    public void set(URL url)

  Adds a url to the MRU file list.

### getMRUFileList

    public String[] getMRUFileList()

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

### moveToTop

    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

### createConfigurationDirectory

    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.

### getInputStream

    protected InputStream getInputStream(File file)
                                  throws IOException,
                                         FileNotFoundException

  Gets an input stream for the corresponding file.

  Parameters:
    `file` - The file to create the input stream from.
  Returns:
    InputStream
  Throws:
    `IOException`
    `FileNotFoundException`

### getInputStream

    protected InputStream getInputStream(URL url)
                                  throws IOException

  Gets an input stream for the corresponding URL.

  Parameters:
    `url` - The url to create the input stream from.
  Returns:
    InputStream
  Throws:
    `IOException`

### setMRU

    protected void setMRU(Object o)

  Adds an object to the mru.

### load

    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.

### getFilename

    protected String getFilename()

### setMaxSize

    protected void setMaxSize(int maxSize)

  Ensures that the MRU list will have a MaxSize.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1999-2012 Apache Software Foundation. All Rights Reserved.