/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: Resource.java,v 1.2 2008/06/25 05:53:08 qcheng Exp $
*
*/
/**
* This utility is used to read any resource such as dtd file or xml file from a
* jar file or from a file system we use java class delegation to the class
* loader to achieve this
*
*/
public final class Resource {
/**
* Reads the resource from a class loader.
*
* @param fileName Resource to be read.
* @param cl Class which delegates the classloader functionality.
* @return resource value.
*/
try {
// may be absoulte file path is given
try {
// works well if the user has given absolute path
} catch (FileNotFoundException e) {
// works well if the user has given the relative path to the
// location of class file
}
}// if
} catch (Exception e) {
return data;
}// read()
/**
* Returns resource string from a reader.
*
* @param aReader Reader object.
* @return resource string from a reader.
*/
try {
char[] data = new char[2048];
int count = 0;
}// while loop
} catch (IOException e) {
}
/**
* Returns resource string from a file.
*
* @param fileName File name.
* Returns resource string from file.
*/
}
/**
* Returns <code>true</code> if a string is successfully written to a file.
*
* @param aFileName File name.
* @param aContent content to be written.
* @return <code>true</code> if a string is successfully written to a file.
*/
try {
return true;
} catch (IOException e) {
return false;
}
}
}