You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



All Packages  This Package  Class Hierarchy  Class Search  Index

Class grendel.storage.NewsRC

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

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


public class  NewsRC
     extends java.lang.Object
{
          // Fields 8
     static final boolean DEBUG;
     protected boolean dirty;
     protected File file;
     protected long file_date;
     protected long file_size;
     protected Vector lines;
     protected ByteBuf options_lines;
     Thread updateThread;

          // Constructors 1
     NewsRC(File) throws IOException;

          // Methods 13
     public Enumeration elements();
     public File file();
     public NewsRCLine getNewsgroup(String);
     private synchronized void load() throws IOException;
     public static void main(String[]);
     protected NewsRCLine makeNewsRCLine(ByteBuf);
     public synchronized void markDirty();
     protected void parse_file(FileInputStream) throws IOException;
     public void save() throws IOException;
     protected void save_internal() throws IOException;
     protected File tempFileName();
     protected synchronized void verifyFileDate(boolean);
     public void write(OutputStream) throws IOException;
}



Fields


DEBUG

   static final boolean DEBUG


file

   protected File file


file_date

   protected long file_date


file_size

   protected long file_size


options_lines

   protected ByteBuf options_lines


lines

   protected Vector lines


dirty

   protected boolean dirty


updateThread

   Thread updateThread



Constructors


NewsRC

   NewsRC(File file)  throws IOException

Reads and parses the file, and returns a NewsRC object describing it. If the file doesn't exist, the newsrc object will be empty.




Methods


load

   private synchronized void load()  throws IOException


file

   public 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(FileInputStream in)  throws IOException


markDirty

   public synchronized void markDirty() 

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



makeNewsRCLine

   protected 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 Enumeration elements() 


getNewsgroup

   public NewsRCLine getNewsgroup(String group_name) 

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



write

   public void write(OutputStream stream)  throws IOException


tempFileName

   protected 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 IOException

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



save_internal

   protected void save_internal()  throws IOException


verifyFileDate

   protected synchronized 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(String[] argv) 


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.4