gov.nasa.gsfc.drl.rtstps.core.xstps.pds
Class OutputFiles

java.lang.Object
  extended by gov.nasa.gsfc.drl.rtstps.core.xstps.pds.OutputFiles

 class OutputFiles
extends java.lang.Object

This class manages the output files. It deals with naming conventions and switching between data files, which it hides from its user.


Nested Class Summary
(package private)  class OutputFiles.Ap
          This class holds a small amount of information about an application id.
(package private)  class OutputFiles.DSFile
          This class holds information about one data file.
 
Field Summary
private  long bytesPerFile
           
private  long bytesWritten
           
private  OutputFiles.DSFile currentFile
           
private  java.util.ArrayList<OutputFiles.DSFile> fileList
           
private  java.lang.StringBuffer fileNameTemplate
           
private  java.io.OutputStream out
           
private  java.lang.String path
           
private  PacketKernel previousPacketKernel
           
private  int[] xappid
           
private  int[] xspid
           
 
Constructor Summary
OutputFiles(java.lang.StringBuffer constructionRecordName, java.lang.String path)
          Create an OutputFiles object.
 
Method Summary
(package private)  void close()
          Close the current data file.
(package private)  int getFileCount()
          Get the number of created data files.
(package private)  java.lang.String getPath()
          Get the directory where this class is putting data files.
private  void openFile()
          Open a file.
(package private)  void setAppidSpid(int apindex, int appid, int spid)
          Set the application id and spacecraft id for a specific application index.
(package private)  void setBytesPerFile(long length)
          Set the number of bytes per file.
(package private)  void write(Packet packet, PacketKernel packetKernel, int apindex)
          Write a packet to a data file.
(package private)  void writeCS(java.io.DataOutput crecord)
          Write file information to the construction record.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileList

private java.util.ArrayList<OutputFiles.DSFile> fileList

bytesPerFile

private long bytesPerFile

previousPacketKernel

private PacketKernel previousPacketKernel

bytesWritten

private long bytesWritten

currentFile

private OutputFiles.DSFile currentFile

fileNameTemplate

private java.lang.StringBuffer fileNameTemplate

path

private java.lang.String path

out

private java.io.OutputStream out

xappid

private int[] xappid

xspid

private int[] xspid
Constructor Detail

OutputFiles

OutputFiles(java.lang.StringBuffer constructionRecordName,
            java.lang.String path)
      throws java.io.IOException
Create an OutputFiles object.

Parameters:
constructionRecordName - The construction record file name
path - The directory where it will put the data files
Throws:
java.io.IOException
Method Detail

setBytesPerFile

final void setBytesPerFile(long length)
Set the number of bytes per file. By default, there is only one output file.


getPath

final java.lang.String getPath()
Get the directory where this class is putting data files.


setAppidSpid

final void setAppidSpid(int apindex,
                        int appid,
                        int spid)
Set the application id and spacecraft id for a specific application index. The index is an array index (0,1,2) and not an application id.


getFileCount

final int getFileCount()
Get the number of created data files.


openFile

private void openFile()
               throws java.io.FileNotFoundException
Open a file.

Throws:
java.io.FileNotFoundException

write

void write(Packet packet,
           PacketKernel packetKernel,
           int apindex)
     throws java.io.IOException
Write a packet to a data file.

Throws:
java.io.IOException

close

void close()
     throws java.io.IOException
Close the current data file.

Throws:
java.io.IOException

writeCS

void writeCS(java.io.DataOutput crecord)
       throws java.io.IOException
Write file information to the construction record.

Throws:
java.io.IOException