Initial commit from SVN.

This commit is contained in:
wcrisman
2014-05-30 10:31:51 -07:00
commit b45e56b890
1968 changed files with 370949 additions and 0 deletions

View File

@@ -0,0 +1,112 @@
/*
* Copyright (c) 2002,2008 Declarative Engineering LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Declarative Engineering LLC
* verson 1 which accompanies this distribution, and is available at
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
*/
package com.common.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import com.common.debug.Debug;
/**
* Addes a few methods to the standard properties code in the JDK.
*/
public class Properties extends java.util.Properties {
/**
* Properties constructor comment.
* @deprecated No longer using this class as anything but a platform for static helper methods.
*/
public Properties() {
super();
}//Properties()//
/**
* Properties constructor comment.
* @param defaults java.util.Properties
* @deprecated No longer using this class as anything but a platform for static helper methods.
*/
public Properties(java.util.Properties defaults) {
super(defaults);
}//Properties()//
/**
* Loads properties from a file.
* @param path The path to the file.
* @return The properties found in the file, or null if the file could not be read or found.
*/
public static java.util.Properties load(String path) {
return load(path, null);
}//load()//
/**
* Loads properties from a file.
* @param path The path to the file.
* @return The properties found in the file, or null if the file could not be read or found.
*/
public static java.util.Properties load(String path, java.util.Properties parent) {
File file = new File(path);
java.util.Properties result = null;
if((file.exists()) && (file.canRead())) {
FileInputStream fin = null;
try {
result = new java.util.Properties(parent);
fin = new FileInputStream(file);
result.load(fin);
}//try//
catch(Throwable e) {
Debug.log(e);
}//catch//
finally {
try {fin.close();}catch(Throwable e) {}
}//finally//
}//if//
return result;
}//load()//
/**
* Stores the properties to file.
* @param path The path to the file.
* @return Whether the store operation was successful.
* @deprecated No longer using this class as anything but a platform for static helper methods.
*/
public boolean store(String path) {
return store(path, this);
}//store//
/**
* Stores the properties to file.
* @param path The path to the file.
* @param properties The properties to be stored.
* @return Whether the store operation was successful.
*/
public static boolean store(String path, java.util.Properties properties) {
FileOutputStream fout = null;
boolean result = false;
try {
fout = new FileOutputStream(path);
properties.store(fout, null);
result = true;
}//try//
catch(Throwable e) {
Debug.log(e);
}//catch//
finally {
try {fout.close();}catch(Throwable e) {}
}//finally//
return result;
}//store()//
/**
* Gets the count of properties.
* @return The number of defined properties.
* @deprecated No longer using this class as anything but a platform for static helper methods.
*/
public int getSize() {
return size();
}//getSize()//
}//Properties//