net.jqhome.jwps.util
Class EAUtil

java.lang.Object
  |
  +--net.jqhome.jwps.util.EAUtil

public class EAUtil
extends java.lang.Object

This utility will allow you to carry out various operations on OS/2 EAs (extended attributes) from the command line. The syntax is as follows:

java net.jqhome.jwps.util.EAUtil -s|-a|-r|-d dataFile eaFile

where the options are

Note: don't delete EAs unless you know what they do. It is therefore suggested that you use the -a flag rather than the -r flag unless there is some compelling reason.
One of the more interesting things about this is that the EAs are converted into XML. You may therefore also set EAs by writing a file with a simple text editor (not a word processor which leaves strange formatting information) and using this utility. See the EA primer for more details.


Constructor Summary
EAUtil()
           
 
Method Summary
static void appendEAs(java.io.File dataFile, java.io.File eaFile)
          Appends the EAs in the eaFile to the dataFile.
static void deleteEAs(java.io.File dataFile)
          Deletes the EAs of the dataFile.
static void main(java.lang.String[] args)
           
static void replaceEAs(java.io.File dataFile, java.io.File eaFile)
          Appends the EAs in the eaFile to the dataFile.
static void saveEAs(java.io.File dataFile, java.io.File eaFile)
          Saves the EAs of the data file to the eaFile.
static void usage()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EAUtil

public EAUtil()
Method Detail

main

public static void main(java.lang.String[] args)

saveEAs

public static void saveEAs(java.io.File dataFile,
                           java.io.File eaFile)
Saves the EAs of the data file to the eaFile. Here is the complete source for this method:

 public static void saveEAs(File dataFile, File eaFile){
   try {
      FileEAs feas = new FileEAs(dataFile);
      XMLDocumentFactory.serialize(feas.getAllEAs(), eaFile);
   } catch (JWPException jwpx) {
      System.out.println("Error: there was a problem saving the EAs. The message is as follows:\n" + jwpx.getMessage());
  } 
 }
 


appendEAs

public static void appendEAs(java.io.File dataFile,
                             java.io.File eaFile)
Appends the EAs in the eaFile to the dataFile. Here is the complete source for this method:

     public static void appendEAs(File dataFile, File eaFile){                                                                
        try {                                                                                                                 
           FileEAs feas = new FileEAs(dataFile);                                                                              
           EAHashtable eaHT = XMLDocumentFactory.deserialize(eaFile);                                                         
           feas.setEAs(eaHT);                                                                                                 
        } catch (JWPException jwpx) {                                                                                         
           System.out.println("Error: there was a problem saving the EAs. The message is as follows:\n" + jwpx.getMessage()); 
        }                                                                                                                     
     } 
 


replaceEAs

public static void replaceEAs(java.io.File dataFile,
                              java.io.File eaFile)
Appends the EAs in the eaFile to the dataFile. Here is the complete source for this method:

                                                                                                                              
   public static void replaceEAs(File dataFile, File eaFile){                                                                 
       try {                                                                                                                  
          FileEAs feas = new FileEAs(dataFile);                                                                               
          feas.removeAllEAs();                                                                                                
          EAHashtable eaHT = XMLDocumentFactory.deserialize(eaFile);                                                          
          feas.setEAs(eaHT);                                                                                                  
       } catch (JWPException jwpx) {                                                                                          
          System.out.println("Error: there was a problem saving the EAs. The message is as follows:\n" + jwpx.getMessage());  
       }                                                                                                                      
    }
 


deleteEAs

public static void deleteEAs(java.io.File dataFile)
Deletes the EAs of the dataFile. Only delete EAs if you know what they do! Here is the complete source for this method:

                                               
    public static void deleteEAs(File dataFile){                                                                                 
       try {                                                                                                                     
          FileEAs feas = new FileEAs(dataFile);                                                                                  
          feas.removeAllEAs();                                                                                                   
       } catch (JWPException jwpx) {                                                                                             
          System.out.println("Error: there was a problem saving the EAs. The message is as follows:\n" + jwpx.getMessage());     
       }                                                                                                                         
    }                                                                                                                            
 


usage

public static void usage()