FileDocCategorySizeDatePackage
IndexPathBean.javaAPI DocExample1620Mon Feb 23 17:15:30 GMT 2004com.develop.ss.config

IndexPathBean

public class IndexPathBean extends Object

Fields Summary
private final String
propFilePath
private String
nextIndexPath
private String
curIndexPath
private String
nextIndex
private Properties
props
Constructors Summary
Methods Summary
public voidflipIndexPath()


        props.setProperty("index.next", nextIndex);
        props.store(new FileOutputStream(propFilePath), "");
    
public java.lang.StringgetFlippedIndexPath()

        getPaths();
        return nextIndexPath;
    
public java.lang.StringgetIndexPath()

            getPaths();
            return curIndexPath;
      
private voidgetPaths()


        
    
        File f = new File(propFilePath);
        if (!f.exists()) {
          throw new IOException("properties path " + propFilePath + " does not exist");
        }
        props = new Properties();
        props.load(new FileInputStream(propFilePath));
        String indexRelativePath = props.getProperty("index.next");
        if (indexRelativePath == null) {
          throw new IllegalArgumentException("indexRelativePath not set in " + propFilePath);
        }
        nextIndex = Integer.toString(1 - Integer.parseInt(indexRelativePath));
        curIndexPath = props.getProperty("index.fullpath") + indexRelativePath;
        nextIndexPath = props.getProperty("index.fullpath") + nextIndex;