avrora.util
Class SectionFile

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FileOutputStream
          extended byavrora.util.SectionFile

public class SectionFile
extends java.io.FileOutputStream

The SectionFile class represents a file that can be used to for source code generation, etc, where a template file has a section of text that needs to be generated, and the rest of the file is not altered. This is accomplished with tags in the file that specify the beginning and end of the section to be filled in.

The SectionFile then behaves just like a FileOutputStream, except on the first write it will skip to the beginning of the section where the output should be inserted. Then on close, the output stream will write the section following the end, remove the old file, and rename the new file to the old file.


Constructor Summary
SectionFile(java.lang.String fname, java.lang.String sect)
           
 
Method Summary
 void close()
           
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 void writeLine(java.lang.String s)
           
 
Methods inherited from class java.io.FileOutputStream
finalize, getChannel, getFD
 
Methods inherited from class java.io.OutputStream
flush
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SectionFile

public SectionFile(java.lang.String fname,
                   java.lang.String sect)
            throws java.io.FileNotFoundException
Method Detail

write

public void write(byte[] b)
           throws java.io.IOException
Throws:
java.io.IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Throws:
java.io.IOException

write

public void write(int b)
           throws java.io.IOException
Throws:
java.io.IOException

writeLine

public void writeLine(java.lang.String s)
               throws java.io.IOException
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException