## grendel.storage
Class NewsRC

    java.lang.Object
      |
      +--grendel.storage.NewsRC

public class NewsRC
extends java.lang.Object

This class represents a newsrc-format disk file, and the newsgroup descriptions within it.

Field Summary
`protected boolean` | `dirty`
`protected java.io.File` | `file`
`protected long` | `file_date`
`protected long` | `file_size`
`protected java.util.Vector` | `lines`
`protected ByteBuf` | `options_lines`

Method Summary
`java.util.Enumeration` | `elements()`
`java.io.File` | `file()` Returns the file associated with this newsrc object.
`grendel.storage.NewsRCLine` | `getNewsgroup(java.lang.String group_name)` Returns a NewsRCLine describing the named newsgroup.
`static void` | `main(java.lang.String[] argv)`
`protected grendel.storage.NewsRCLine` | `makeNewsRCLine(ByteBuf line_buf)` Parses the given line and creates a NewsRCLine object representing it.
`void` | `markDirty()` Call this to indicate that the file needs to be flushed to disk.
`protected void` | `parse_file(java.io.FileInputStream in)`
`protected void` | `save_internal()`
`void` | `save()` Writes the file associated with this NewsRC object, if there have been any changes to it.
`protected java.io.File` | `tempFileName()` Returns the name of a non-existent file that can be used as a temporary file while writing this newsrc.
`protected void` | `verifyFileDate(boolean was_dirty)` Compare the current date/size of the disk file with the date/size at the time we read it, and if the disk version has changed, do something sensible.
`void` | `write(java.io.OutputStream stream)`

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

Field Detail

### file

    protected java.io.File file

### file_date

    protected long file_date

### file_size

    protected long file_size

### options_lines

    protected ByteBuf options_lines

### lines

    protected java.util.Vector lines

### dirty

    protected boolean dirty

Method Detail

### file

    public java.io.File file()

  Returns the file associated with this newsrc object. Note that the file may not actually exist on disk yet.

### parse_file

    protected void parse_file(java.io.FileInputStream in)
                       throws java.io.IOException

### markDirty

    public void markDirty()

  Call this to indicate that the file needs to be flushed to disk.

### makeNewsRCLine

    protected grendel.storage.NewsRCLine makeNewsRCLine(ByteBuf line_buf)

  Parses the given line and creates a NewsRCLine object representing it. Returns null if the line is unparsable.

### elements

    public java.util.Enumeration elements()

### getNewsgroup

    public grendel.storage.NewsRCLine getNewsgroup(java.lang.String group_name)

  Returns a NewsRCLine describing the named newsgroup. If there isn't one, creates one.

### write

    public void write(java.io.OutputStream stream)
               throws java.io.IOException

### tempFileName

    protected java.io.File tempFileName()

  Returns the name of a non-existent file that can be used as a temporary file while writing this newsrc. This name is OS-dependent.

  On all systems, the summary file resides in the same directory as the folder file, and has the same "base" name.

  On Unix, the summary file for `.newsrc-HOSTNAME` would be `.newsrc-HOSTNAME.ns_tmp`.

  On Windows and Mac, the summary file for `news-HOSTNAME.rc` would be `news-HOSTNAME.TMP`.

### save

    public void save()
              throws java.io.IOException

  Writes the file associated with this NewsRC object, if there have been any changes to it.

### save_internal

    protected void save_internal()
                          throws java.io.IOException

### verifyFileDate

    protected void verifyFileDate(boolean was_dirty)

  Compare the current date/size of the disk file with the date/size at the time we read it, and if the disk version has changed, do something sensible.

### main

    public static void main(java.lang.String[] argv)