[opencms-dev] Getting content of a file
Dhariwal, Rathan
Rathan.Dhariwal at tdsecurities.com
Fri Oct 15 19:16:54 CEST 2004
Hi
I am having problem reading content of plain file.
Actually I have CmsFile object with me retrieved by reading files from
folder,
Using the CmsFile object I am able get the resource name and properties
as expected.
But for some reason I am still getting the content as zero length.
Here is the section of code
Please help
Thanks and Regards
Ratan...
----
while(i.hasNext()){
file = (CmsFile) i.next();
fileUrl = cms.link(file.getAbsolutePath());
fileExt = file.getExtension();
rescName = file.getResourceName();
if (file.getContents().length > 0) {
content ="Content is " + new String(file.getContents());
} else {
content = "No content defined";
}
if (!(fileExt.equals(".jsp") || fileUrl.endsWith("index.html"))) {
if (rescName.startsWith (rootName)){
fileAbsPath = rescName.substring(rootName.length());
} else {
fileAbsPath = rescName;
}
title = cmso.readProperty (fileAbsPath ,"Title", false,
"Property 'Title' not defined");
desc = cmso.readProperty (fileAbsPath ,"Description", false,
"Property 'Description' not defined");
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20041015/9ccb3347/attachment.htm>
More information about the opencms-dev
mailing list