*** empty log message ***

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353008 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Rainer Klute 2003-02-20 17:51:37 +00:00
parent 4fb4cb6b95
commit 3639f502a4

View File

@ -74,36 +74,36 @@ public class ReadTitle
public static void main(String[] args) throws IOException public static void main(String[] args) throws IOException
{ {
final String filename = args[0]; final String filename = args[0];
POIFSReader r = new POIFSReader(); POIFSReader r = new POIFSReader();
r.registerListener(new MyPOIFSReaderListener(), r.registerListener(new MyPOIFSReaderListener(),
"\005SummaryInformation"); "\005SummaryInformation");
r.read(new FileInputStream(filename)); r.read(new FileInputStream(filename));
} }
static class MyPOIFSReaderListener implements POIFSReaderListener static class MyPOIFSReaderListener implements POIFSReaderListener
{ {
public void processPOIFSReaderEvent(POIFSReaderEvent event) public void processPOIFSReaderEvent(POIFSReaderEvent event)
{ {
SummaryInformation si = null; SummaryInformation si = null;
try try
{ {
si = (SummaryInformation) si = (SummaryInformation)
PropertySetFactory.create(event.getStream()); PropertySetFactory.create(event.getStream());
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new RuntimeException throw new RuntimeException
("Property set stream \"" + ("Property set stream \"" +
event.getPath() + event.getName() + "\": " + ex); event.getPath() + event.getName() + "\": " + ex);
} }
final String title = si.getTitle(); final String title = si.getTitle();
if (title != null) if (title != null)
System.out.println("Title: \"" + title + "\""); System.out.println("Title: \"" + title + "\"");
else else
System.out.println("Document has no title."); System.out.println("Document has no title.");
} }
} }
} }