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: 10$ $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 ProjectNodeFS getRootNodeForArchive(ArchiveInfoFS info, NodeLibraryFS lib)
           
static java.io.File getSourceFilePointer(java.lang.String rootPath, java.lang.String fileName)
           
static void moveSourceFile(java.io.File flSource, java.lang.String rootPath, java.lang.String fileName)
           
static Delta readDeltaFromFileSys(java.lang.String rootPath, java.lang.String fileName)
           
static FileNodeFS readFileNodeFromFileSys(java.lang.String rootPath, java.lang.String fileName, long key)
           
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 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 ProjectNodeFS readProjectNode(java.lang.String rootPath, java.lang.String fileName, long key, 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 writeDeltaToFileSys(Delta delta, java.lang.String rootPath, java.lang.String fileName)
           
static void writeFileToFileSys(byte[] fullFile, java.lang.String rootPath, java.lang.String fileName)
          Writes the full file to the specified location on the file system.
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.
 
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

writeFileToFileSys

public static void writeFileToFileSys(byte[] fullFile,
                                      java.lang.String rootPath,
                                      java.lang.String fileName)
                               throws java.io.IOException
Writes the full file to the specified location on the file system. If the file already exists, it will be overwritten.

java.io.IOException

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

writeDeltaToFileSys

public static void writeDeltaToFileSys(Delta delta,
                                       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

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)
                                          throws java.io.IOException,
                                                 org.xml.sax.SAXException,
                                                 org.sourcejammer.xml.XMLNodeDoesNotExistException
java.io.IOException
org.xml.sax.SAXException
org.sourcejammer.xml.XMLNodeDoesNotExistException

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

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

getRootNodeForArchive

public static ProjectNodeFS getRootNodeForArchive(ArchiveInfoFS info,
                                                  NodeLibraryFS lib)
                                           throws java.io.IOException,
                                                  org.sourcejammer.project.NodeDoesNotExistException,
                                                  org.sourcejammer.xml.XMLNodeDoesNotExistException,
                                                  org.xml.sax.SAXException
java.io.IOException
org.sourcejammer.project.NodeDoesNotExistException
org.sourcejammer.xml.XMLNodeDoesNotExistException
org.xml.sax.SAXException

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,
                                            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

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

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.


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.