01: /* ====================================================================
02: Licensed to the Apache Software Foundation (ASF) under one or more
03: contributor license agreements. See the NOTICE file distributed with
04: this work for additional information regarding copyright ownership.
05: The ASF licenses this file to You under the Apache License, Version 2.0
06: (the "License"); you may not use this file except in compliance with
07: the License. You may obtain a copy of the License at
08:
09: http://www.apache.org/licenses/LICENSE-2.0
10:
11: Unless required by applicable law or agreed to in writing, software
12: distributed under the License is distributed on an "AS IS" BASIS,
13: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: See the License for the specific language governing permissions and
15: limitations under the License.
16: ==================================================================== */
17:
18: package org.apache.poi.contrib.poibrowser;
19:
20: import java.io.IOException;
21: import java.io.UnsupportedEncodingException;
22:
23: import org.apache.poi.hpsf.MarkUnsupportedException;
24: import org.apache.poi.hpsf.NoPropertySetStreamException;
25: import org.apache.poi.hpsf.PropertySet;
26: import org.apache.poi.hpsf.PropertySetFactory;
27: import org.apache.poi.poifs.filesystem.DocumentInputStream;
28: import org.apache.poi.poifs.filesystem.POIFSDocumentPath;
29:
30: /**
31: * <p>Describes the most important (whatever that is) features of a
32: * stream containing a {@link PropertySet}.</p>
33: *
34: * @author Rainer Klute (klute@rainer-klute.de)
35: * @version $Id: PropertySetDescriptor.java 489730 2006-12-22 19:18:16Z bayard $
36: * @since 2002-02-05
37: */
38: public class PropertySetDescriptor extends DocumentDescriptor {
39:
40: protected PropertySet propertySet;
41:
42: /**
43: * <p>Returns this {@link PropertySetDescriptor}'s {@link
44: * PropertySet}.</p>
45: */
46: public PropertySet getPropertySet() {
47: return propertySet;
48: }
49:
50: /**
51: * <p>Creates a {@link PropertySetDescriptor} by reading a {@link
52: * PropertySet} from a {@link DocumentInputStream}.</p>
53: *
54: * @param name The stream's name.
55: *
56: * @param path The stream's path in the POI filesystem hierarchy.
57: *
58: * @param stream The stream.
59: *
60: * @param nrOfBytesToDump The maximum number of bytes to display in a
61: * dump starting at the beginning of the stream.
62: */
63: public PropertySetDescriptor(final String name,
64: final POIFSDocumentPath path,
65: final DocumentInputStream stream, final int nrOfBytesToDump)
66: throws NoPropertySetStreamException,
67: MarkUnsupportedException, UnsupportedEncodingException,
68: IOException {
69: super(name, path, stream, nrOfBytesToDump);
70: propertySet = PropertySetFactory.create(stream);
71: }
72:
73: }
|