DiskList (Hyperic HQ Plugin API)
Keywords: org.hyperic.util.file.DiskList class

Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hyperic.util.file
Class DiskList

    java.lang.Object
      org.hyperic.util.file.DiskList

    public class DiskList

extends java.lang.Object

A DiskList is a representation of a list on disk. The basic usage is to add members to the end of the list, and remove entries from it. The iterators returned support the remove() operation, but will throw a ConcurrentModificationException and fail-fast if an update is detected while iteration is occuring. The storage is contained in 2 files, one housing the data, and the other housing the index. The format of the data file is as follows: [Record] data - recordSize bytes containing the raw data The format of the index file is as follows: [Idx] boolean - Indicates whether the record is in use or not long int - Index of the previous record long int - Index of the next record

Nested Class Summary
`static class` | `DiskList.DiskListIterator`

Field Summary
`protected java.io.RandomAccessFile` | `dataFile`
`protected java.util.SortedSet` | `freeList`

Constructor Summary
`DiskList(java.io.File dataFile, int recordSize, long checkSize, int checkPerc)` Construct a new DiskList
`DiskList(java.io.File dataFile, int recordSize, long checkSize, int checkPerc, long maxLength)` Construct a new DiskList

Method Summary
`void` | `addToList(java.lang.String data)` Add the string to the list of data being stored in the DiskList.
`void` | `close()` Close the DiskList.
`void` | `deleteAllRecords()` Delete all the records from storage.
`java.util.Iterator` | `getListIterator()`
`static void` | `main(java.lang.String[] args)`

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

Field Detail

### dataFile

    protected java.io.RandomAccessFile dataFile

### freeList

    protected java.util.SortedSet freeList

Constructor Detail

### DiskList

    public DiskList(java.io.File dataFile,
                    int recordSize,
                    long checkSize,
                    int checkPerc)
             throws java.io.IOException

  Construct a new DiskList

  Throws:
    `java.io.IOException`

### DiskList

    public DiskList(java.io.File dataFile,
                    int recordSize,
                    long checkSize,
                    int checkPerc,
                    long maxLength)
             throws java.io.IOException

  Construct a new DiskList

  Parameters:
    `dataFile` - the base location for the datafile. The index file will be the same, with .idx appended
    `recordSize` - The maximum size for any record within the data file. All records in the list will occupy this many bytes worth of data
    `checkSize` - Size in to bytes to start checking for unused blocks
    `checkPerc` - Maximum percentage of free blocks allowed when data file is greater than checkSize.
  Throws:
    `java.io.IOException`

Method Detail

### addToList

    public void addToList(java.lang.String data)
                   throws java.io.IOException

  Add the string to the list of data being stored in the DiskList.

  Parameters:
    `data` - Data to add to the end of the list
  Throws:
    `java.io.IOException`

### deleteAllRecords

    public void deleteAllRecords()
                          throws java.io.IOException

  Delete all the records from storage.

  Throws:
    `java.io.IOException`

### close

    public void close()
               throws java.io.IOException

  Close the DiskList. All subsequent methods will result in an IOException being thrown.

  Throws:
    `java.io.IOException`

### getListIterator

    public java.util.Iterator getListIterator()

### main

    public static void main(java.lang.String[] args)
                     throws java.lang.Exception

  Throws:
    `java.lang.Exception`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.