org.sourcejammer.project.model.filesys
Class Util

java.lang.Object
  |
  +--org.sourcejammer.project.model.filesys.Util

public class Util
extends java.lang.Object

Title: $FileName: Util.java$

Version:
$VerNum: 12$ $KeyWordsOff: $

Utiliy class for reading from and writing to the file system.
Author:
$AuthorName: Rob MacGrogan$

Nested Class Summary
static class Util.Directories
           
static class Util.Files
           
 
Constructor Summary
Util()
           
 
Method Summary
static void addArchiveDirectories(java.lang.String archiveRootPath)
           
static void deleteFileFromFileSys(java.lang.String sFullFilePath)
          Deletes the file at the specified location.
static void deleteNodeAndAllChildrenFromFileSys(java.lang.String rootPath, NodeFS node, NodeLibraryFS lib)
          Removes the node and all of its children from the file system.
static java.lang.String getNextUniqueFileName(java.lang.String fullPathAndFileName)
          Return the next unique file name.
static java.lang.String getNextUniqueFileName(java.lang.String rootPath, java.lang.String sDirectory)
          Return the next unique file name.
static java.io.File getSourceFilePointer(java.lang.String rootPath, java.lang.String fileName)
           
static java.io.File getVersionCommentPointer(java.lang.String rootPath, java.lang.String fileName)
           
static void moveSourceFile(java.io.File flSource, java.lang.String rootPath, java.lang.String fileName)
           
static void permanentlyDeleteFileNode(java.lang.String rootPath, FileNodeFS file, NodeLibraryFS lib)
          Deletes all file associated with the file from the filesystem.
static void permanentlyDeleteProjectNode(java.lang.String rootPath, ProjectNodeFS project)
          Just deleted project file.
static Delta readDeltaFromFileSys(java.lang.String rootPath, java.lang.String fileName)
           
static FileNodeFS readFileNodeFromFileSys(java.lang.String rootPath, java.lang.String fileName, long key, FileNodeFS node)
           
static byte[] readFullFileFromFileSys(java.lang.String rootPath, java.lang.String fileName)
           
static TextLineReader readFullTextFileFromFileSys(java.lang.String rootPath, java.lang.String fileName)
          Reads the full source of a text file from the SOURCE directory and casts it to a TextLineReader object.
static MasterFileNodeFS readMasterFileNodeFromFileSys(java.lang.String rootPath, java.lang.String fileName, long key, MasterFileNodeFS master)
           
static java.lang.String readNodeName(java.lang.String rootPath, java.lang.String fileName, int iNodeType)
           
static ProjectNodeFS readProjectNode(java.lang.String rootPath, java.lang.String fileName, long key, java.util.Hashtable hshShareParents, ProjectNodeFS ndProject, NodeLibraryFS lib)
           
static TextDiff readTextDiffFromFileSys(java.lang.String rootPath, java.lang.String fileName)
           
static java.lang.String readTextFileFromFileSys(java.lang.String fullPathAndFile)
          Returns contents of text file at specified location as String.
static java.lang.String readVersionComment(java.lang.String rootPath, java.lang.String fileName)
           
static org.w3c.dom.Document readXMLDocFromFileSys(java.lang.String fullPathAndName)
          Reads an XML file (stored as text) from the specified file location, and returns its contents as a Document object.
static void writeTextDiffToFileSys(TextDiff diff, java.lang.String rootPath, java.lang.String fileName)
           
static void writeTextFileToFileSys(java.lang.String textFile, java.lang.String fullPathAndName)
          Writes textFile to filesystem as a file using fullPathAndName as file name.
static void writeVersionComment(java.lang.String comment, java.lang.String rootPath, java.lang.String fileName)
           
static void writeXMLDocToFileSys(org.w3c.dom.Document doc, java.lang.String fullPathAndName)
          Converts XML doc to text and saves it to file system using fullPathAndName as file name.
static void writeXMLDocToFileSys(org.w3c.dom.Document doc, java.lang.String fullPathAndName, boolean indent)
          Converts XML doc to text and saves it to file system using fullPathAndName as file name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

getSourceFilePointer

public static java.io.File getSourceFilePointer(java.lang.String rootPath,
                                                java.lang.String fileName)

moveSourceFile

public static void moveSourceFile(java.io.File flSource,
                                  java.lang.String rootPath,
                                  java.lang.String fileName)
                           throws java.io.IOException
java.io.IOException

writeTextDiffToFileSys

public static void writeTextDiffToFileSys(TextDiff diff,
                                          java.lang.String rootPath,
                                          java.lang.String fileName)
                                   throws java.io.IOException
java.io.IOException

writeTextFileToFileSys

public static void writeTextFileToFileSys(java.lang.String textFile,
                                          java.lang.String fullPathAndName)
                                   throws java.io.IOException
Writes textFile to filesystem as a file using fullPathAndName as file name. If file already exists, this method overwrites it without throwing an exception.

java.io.IOException

writeXMLDocToFileSys

public static void writeXMLDocToFileSys(org.w3c.dom.Document doc,
                                        java.lang.String fullPathAndName)
                                 throws java.io.IOException
Converts XML doc to text and saves it to file system using fullPathAndName as file name. Overwrites file if it already exists.

java.io.IOException

writeXMLDocToFileSys

public static void writeXMLDocToFileSys(org.w3c.dom.Document doc,
                                        java.lang.String fullPathAndName,
                                        boolean indent)
                                 throws java.io.IOException
Converts XML doc to text and saves it to file system using fullPathAndName as file name. Overwrites file if it already exists.

java.io.IOException

readTextFileFromFileSys

public static java.lang.String readTextFileFromFileSys(java.lang.String fullPathAndFile)
                                                throws java.io.IOException
Returns contents of text file at specified location as String.

java.io.IOException

readDeltaFromFileSys

public static Delta readDeltaFromFileSys(java.lang.String rootPath,
                                         java.lang.String fileName)
                                  throws java.io.IOException
java.io.IOException

readTextDiffFromFileSys

public static TextDiff readTextDiffFromFileSys(java.lang.String rootPath,
                                               java.lang.String fileName)
                                        throws java.io.IOException,
                                               JLibDiff.DiffFormatException
java.io.IOException
JLibDiff.DiffFormatException

readXMLDocFromFileSys

public static org.w3c.dom.Document readXMLDocFromFileSys(java.lang.String fullPathAndName)
                                                  throws java.io.IOException,
                                                         org.xml.sax.SAXException
Reads an XML file (stored as text) from the specified file location, and returns its contents as a Document object.

java.io.IOException
org.xml.sax.SAXException

readFileNodeFromFileSys

public static FileNodeFS readFileNodeFromFileSys(java.lang.String rootPath,
                                                 java.lang.String fileName,
                                                 long key,
                                                 FileNodeFS node)
                                          throws java.io.IOException,
                                                 org.xml.sax.SAXException,
                                                 org.sourcejammer.xml.XMLNodeDoesNotExistException
java.io.IOException
org.xml.sax.SAXException
org.sourcejammer.xml.XMLNodeDoesNotExistException

readMasterFileNodeFromFileSys

public static MasterFileNodeFS readMasterFileNodeFromFileSys(java.lang.String rootPath,
                                                             java.lang.String fileName,
                                                             long key,
                                                             MasterFileNodeFS master)
                                                      throws java.io.IOException,
                                                             org.xml.sax.SAXException,
                                                             org.sourcejammer.xml.XMLNodeDoesNotExistException
java.io.IOException
org.xml.sax.SAXException
org.sourcejammer.xml.XMLNodeDoesNotExistException

readFullFileFromFileSys

public static byte[] readFullFileFromFileSys(java.lang.String rootPath,
                                             java.lang.String fileName)
                                      throws java.io.IOException
java.io.IOException

readFullTextFileFromFileSys

public static TextLineReader readFullTextFileFromFileSys(java.lang.String rootPath,
                                                         java.lang.String fileName)
                                                  throws java.io.IOException
Reads the full source of a text file from the SOURCE directory and casts it to a TextLineReader object.

java.io.IOException

readNodeName

public static java.lang.String readNodeName(java.lang.String rootPath,
                                            java.lang.String fileName,
                                            int iNodeType)
                                     throws java.io.IOException,
                                            org.sourcejammer.xml.XMLNodeDoesNotExistException,
                                            org.xml.sax.SAXException
java.io.IOException
org.sourcejammer.xml.XMLNodeDoesNotExistException
org.xml.sax.SAXException

readProjectNode

public static ProjectNodeFS readProjectNode(java.lang.String rootPath,
                                            java.lang.String fileName,
                                            long key,
                                            java.util.Hashtable hshShareParents,
                                            ProjectNodeFS ndProject,
                                            NodeLibraryFS lib)
                                     throws java.io.IOException,
                                            org.xml.sax.SAXException,
                                            org.sourcejammer.xml.XMLNodeDoesNotExistException,
                                            org.sourcejammer.project.NodeDoesNotExistException
java.io.IOException
org.xml.sax.SAXException
org.sourcejammer.xml.XMLNodeDoesNotExistException
org.sourcejammer.project.NodeDoesNotExistException

readVersionComment

public static java.lang.String readVersionComment(java.lang.String rootPath,
                                                  java.lang.String fileName)
                                           throws java.io.IOException
java.io.IOException

getVersionCommentPointer

public static java.io.File getVersionCommentPointer(java.lang.String rootPath,
                                                    java.lang.String fileName)

writeVersionComment

public static void writeVersionComment(java.lang.String comment,
                                       java.lang.String rootPath,
                                       java.lang.String fileName)
                                throws java.io.IOException
java.io.IOException

getNextUniqueFileName

public static java.lang.String getNextUniqueFileName(java.lang.String rootPath,
                                                     java.lang.String sDirectory)
Return the next unique file name.


getNextUniqueFileName

public static java.lang.String getNextUniqueFileName(java.lang.String fullPathAndFileName)
Return the next unique file name.


permanentlyDeleteProjectNode

public static void permanentlyDeleteProjectNode(java.lang.String rootPath,
                                                ProjectNodeFS project)
                                         throws java.io.IOException
Just deleted project file. Does not delete any child file object. It is up to the calling routine to manage that.

java.io.IOException

permanentlyDeleteFileNode

public static void permanentlyDeleteFileNode(java.lang.String rootPath,
                                             FileNodeFS file,
                                             NodeLibraryFS lib)
                                      throws java.io.IOException
Deletes all file associated with the file from the filesystem.

java.io.IOException

deleteNodeAndAllChildrenFromFileSys

public static void deleteNodeAndAllChildrenFromFileSys(java.lang.String rootPath,
                                                       NodeFS node,
                                                       NodeLibraryFS lib)
                                                throws java.io.IOException,
                                                       SecurityException,
                                                       org.sourcejammer.project.NodeDoesNotExistException,
                                                       FileAccessException
Removes the node and all of its children from the file system.

java.io.IOException
SecurityException
org.sourcejammer.project.NodeDoesNotExistException
FileAccessException

deleteFileFromFileSys

public static void deleteFileFromFileSys(java.lang.String sFullFilePath)
                                  throws java.io.IOException
Deletes the file at the specified location.

java.io.IOException

addArchiveDirectories

public static void addArchiveDirectories(java.lang.String archiveRootPath)
                                  throws java.io.IOException
java.io.IOException


Copyright 2003 Soucejammer project.