Package org.apache.poi.hpsf
Class SummaryInformation
- java.lang.Object
-
- org.apache.poi.hpsf.PropertySet
-
- org.apache.poi.hpsf.SummaryInformation
-
public final class SummaryInformation extends PropertySet
Convenience class representing a Summary Information stream in a Microsoft Office document.- See Also:
DocumentSummaryInformation
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_STREAM_NAMEThe document name a summary information stream usually has in a POIFS filesystem.static ClassIDFORMAT_IDThe SummaryInformation's section's format ID.-
Fields inherited from class org.apache.poi.hpsf.PropertySet
OS_MACINTOSH, OS_WIN16, OS_WIN32
-
-
Constructor Summary
Constructors Constructor Description SummaryInformation()Creates an empty SummaryInformation.SummaryInformation(InputStream stream)Creates a SummaryInformation instance from anInputStreamin the Horrible Property Set Format.SummaryInformation(PropertySet ps)Creates a SummaryInformation from a givenPropertySet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetApplicationName()Returns the application name (ornull).StringgetAuthor()Returns the author (ornull).intgetCharCount()Returns the character count or 0 if the SummaryInformation does not contain a char count.StringgetComments()Returns the comments (ornull).DategetCreateDateTime()Returns the creation time (ornull).longgetEditTime()Returns the total time spent in editing the document (or0).StringgetKeywords()Returns the keywords (ornull).StringgetLastAuthor()Returns the last author (ornull).DategetLastPrinted()Returns the last printed time (ornull).DategetLastSaveDateTime()Returns the last save time (ornull).intgetPageCount()Returns the page count or 0 if the SummaryInformation does not contain a page count.PropertyIDMapgetPropertySetIDMap()The id to name mapping of the properties in this set.StringgetRevNumber()Returns the revision number (ornull).intgetSecurity()Returns a security code which is one of the following values: 0 if the SummaryInformation does not contain a security field or if there is no security on the document.StringgetSubject()Returns the subject (ornull).StringgetTemplate()Returns the template (ornull).byte[]getThumbnail()Returns the thumbnail (ornull) when this method is implemented.ThumbnailgetThumbnailThumbnail()Returns the thumbnail (ornull), processed as an object which is (largely) able to unpack the thumbnail image data.StringgetTitle()intgetWordCount()Returns the word count or 0 if the SummaryInformation does not contain a word count.voidremoveApplicationName()Removes the application name.voidremoveAuthor()Removes the author.voidremoveCharCount()Removes the character count.voidremoveComments()Removes the comments.voidremoveCreateDateTime()Removes the creation time.voidremoveEditTime()Remove the total time spent in editing the document.voidremoveKeywords()Removes the keywords.voidremoveLastAuthor()Removes the last author.voidremoveLastPrinted()Removes the lastPrinted.voidremoveLastSaveDateTime()Remove the total time spent in editing the document.voidremovePageCount()Removes the page count.voidremoveRevNumber()Removes the revision number.voidremoveSecurity()Removes the security code.voidremoveSubject()Removes the subject.voidremoveTemplate()Removes the template.voidremoveThumbnail()Removes the thumbnail.voidremoveTitle()Removes the title.voidremoveWordCount()Removes the word count.voidsetApplicationName(String applicationName)Sets the application name.voidsetAuthor(String author)Sets the author.voidsetCharCount(int charCount)Sets the character count.voidsetComments(String comments)Sets the comments.voidsetCreateDateTime(Date createDateTime)Sets the creation time.voidsetEditTime(long time)Sets the total time spent in editing the document.voidsetKeywords(String keywords)Sets the keywords.voidsetLastAuthor(String lastAuthor)Sets the last author.voidsetLastPrinted(Date lastPrinted)Sets the lastPrinted.voidsetLastSaveDateTime(Date time)Sets the total time spent in editing the document.voidsetPageCount(int pageCount)Sets the page count.voidsetRevNumber(String revNumber)Sets the revision number.voidsetSecurity(int security)Sets the security code.voidsetSubject(String subject)Sets the subject.voidsetTemplate(String template)Sets the template.voidsetThumbnail(byte[] thumbnail)Sets the thumbnail.voidsetTitle(String title)Sets the title.voidsetWordCount(int wordCount)Sets the word count.-
Methods inherited from class org.apache.poi.hpsf.PropertySet
addSection, clearSections, equals, getByteOrder, getClassID, getFirstSection, getFormat, getOSVersion, getProperties, getProperty, getPropertyStringValue, getSectionCount, getSections, hashCode, isDocumentSummaryInformation, isPropertySetStream, isPropertySetStream, isSummaryInformation, setByteOrder, setClassID, setFormat, setOSVersion, toInputStream, toString, wasNull, write, write
-
-
-
-
Field Detail
-
DEFAULT_STREAM_NAME
public static final String DEFAULT_STREAM_NAME
The document name a summary information stream usually has in a POIFS filesystem.- See Also:
- Constant Field Values
-
FORMAT_ID
public static final ClassID FORMAT_ID
The SummaryInformation's section's format ID.
-
-
Constructor Detail
-
SummaryInformation
public SummaryInformation()
Creates an empty SummaryInformation.
-
SummaryInformation
public SummaryInformation(PropertySet ps) throws UnexpectedPropertySetTypeException
Creates a SummaryInformation from a givenPropertySet.- Parameters:
ps- A property set which should be created from a summary information stream.- Throws:
UnexpectedPropertySetTypeException- ifpsdoes not contain a summary information stream.
-
SummaryInformation
public SummaryInformation(InputStream stream) throws NoPropertySetStreamException, IOException
Creates a SummaryInformation instance from anInputStreamin the Horrible Property Set Format.The constructor reads the first few bytes from the stream and determines whether it is really a property set stream. If it is, it parses the rest of the stream. If it is not, it resets the stream to its beginning in order to let other components mess around with the data and throws an exception.
- Parameters:
stream- Holds the data making out the property set stream.- Throws:
IOException- if theInputStreamcannot be accessed as needed.NoPropertySetStreamException- if the input stream does not contain a property set.UnsupportedEncodingException- if a character encoding is not supported.
-
-
Method Detail
-
getPropertySetIDMap
public PropertyIDMap getPropertySetIDMap()
Description copied from class:PropertySetThe id to name mapping of the properties in this set.- Overrides:
getPropertySetIDMapin classPropertySet- Returns:
- the id to name mapping of the properties in this set or
nullif not applicable
-
getTitle
public String getTitle()
- Returns:
- The title or
null
-
setTitle
public void setTitle(String title)
Sets the title.- Parameters:
title- The title to set.
-
removeTitle
public void removeTitle()
Removes the title.
-
getSubject
public String getSubject()
Returns the subject (ornull).- Returns:
- The subject or
null
-
setSubject
public void setSubject(String subject)
Sets the subject.- Parameters:
subject- The subject to set.
-
removeSubject
public void removeSubject()
Removes the subject.
-
getAuthor
public String getAuthor()
Returns the author (ornull).- Returns:
- The author or
null
-
setAuthor
public void setAuthor(String author)
Sets the author.- Parameters:
author- The author to set.
-
removeAuthor
public void removeAuthor()
Removes the author.
-
getKeywords
public String getKeywords()
Returns the keywords (ornull).- Returns:
- The keywords or
null
-
setKeywords
public void setKeywords(String keywords)
Sets the keywords.- Parameters:
keywords- The keywords to set.
-
removeKeywords
public void removeKeywords()
Removes the keywords.
-
getComments
public String getComments()
Returns the comments (ornull).- Returns:
- The comments or
null
-
setComments
public void setComments(String comments)
Sets the comments.- Parameters:
comments- The comments to set.
-
removeComments
public void removeComments()
Removes the comments.
-
getTemplate
public String getTemplate()
Returns the template (ornull).- Returns:
- The template or
null
-
setTemplate
public void setTemplate(String template)
Sets the template.- Parameters:
template- The template to set.
-
removeTemplate
public void removeTemplate()
Removes the template.
-
getLastAuthor
public String getLastAuthor()
Returns the last author (ornull).- Returns:
- The last author or
null
-
setLastAuthor
public void setLastAuthor(String lastAuthor)
Sets the last author.- Parameters:
lastAuthor- The last author to set.
-
removeLastAuthor
public void removeLastAuthor()
Removes the last author.
-
getRevNumber
public String getRevNumber()
Returns the revision number (ornull).- Returns:
- The revision number or
null
-
setRevNumber
public void setRevNumber(String revNumber)
Sets the revision number.- Parameters:
revNumber- The revision number to set.
-
removeRevNumber
public void removeRevNumber()
Removes the revision number.
-
getEditTime
public long getEditTime()
Returns the total time spent in editing the document (or0).- Returns:
- The total time spent in editing the document or 0 if the
SummaryInformationdoes not contain this information.
-
setEditTime
public void setEditTime(long time)
Sets the total time spent in editing the document.- Parameters:
time- The time to set.
-
removeEditTime
public void removeEditTime()
Remove the total time spent in editing the document.
-
getLastPrinted
public Date getLastPrinted()
Returns the last printed time (ornull).- Returns:
- The last printed time or
null
-
setLastPrinted
public void setLastPrinted(Date lastPrinted)
Sets the lastPrinted.- Parameters:
lastPrinted- The lastPrinted to set.
-
removeLastPrinted
public void removeLastPrinted()
Removes the lastPrinted.
-
getCreateDateTime
public Date getCreateDateTime()
Returns the creation time (ornull).- Returns:
- The creation time or
null
-
setCreateDateTime
public void setCreateDateTime(Date createDateTime)
Sets the creation time.- Parameters:
createDateTime- The creation time to set.
-
removeCreateDateTime
public void removeCreateDateTime()
Removes the creation time.
-
getLastSaveDateTime
public Date getLastSaveDateTime()
Returns the last save time (ornull).- Returns:
- The last save time or
null
-
setLastSaveDateTime
public void setLastSaveDateTime(Date time)
Sets the total time spent in editing the document.- Parameters:
time- The time to set.
-
removeLastSaveDateTime
public void removeLastSaveDateTime()
Remove the total time spent in editing the document.
-
getPageCount
public int getPageCount()
Returns the page count or 0 if the SummaryInformation does not contain a page count.- Returns:
- The page count or 0 if the SummaryInformation does not contain a page count.
-
setPageCount
public void setPageCount(int pageCount)
Sets the page count.- Parameters:
pageCount- The page count to set.
-
removePageCount
public void removePageCount()
Removes the page count.
-
getWordCount
public int getWordCount()
Returns the word count or 0 if the SummaryInformation does not contain a word count.- Returns:
- The word count or
null
-
setWordCount
public void setWordCount(int wordCount)
Sets the word count.- Parameters:
wordCount- The word count to set.
-
removeWordCount
public void removeWordCount()
Removes the word count.
-
getCharCount
public int getCharCount()
Returns the character count or 0 if the SummaryInformation does not contain a char count.- Returns:
- The character count or
null
-
setCharCount
public void setCharCount(int charCount)
Sets the character count.- Parameters:
charCount- The character count to set.
-
removeCharCount
public void removeCharCount()
Removes the character count.
-
getThumbnail
public byte[] getThumbnail()
Returns the thumbnail (ornull) when this method is implemented. Please note that the return type is likely to change!To process this data, you may wish to make use of the
Thumbnailclass. The raw data is generally an image in WMF or Clipboard (BMP?) format- Returns:
- The thumbnail or
null
-
getThumbnailThumbnail
public Thumbnail getThumbnailThumbnail()
Returns the thumbnail (ornull), processed as an object which is (largely) able to unpack the thumbnail image data.- Returns:
- The thumbnail or
null
-
setThumbnail
public void setThumbnail(byte[] thumbnail)
Sets the thumbnail.- Parameters:
thumbnail- The thumbnail to set.
-
removeThumbnail
public void removeThumbnail()
Removes the thumbnail.
-
getApplicationName
public String getApplicationName()
Returns the application name (ornull).- Returns:
- The application name or
null
-
setApplicationName
public void setApplicationName(String applicationName)
Sets the application name.- Parameters:
applicationName- The application name to set.
-
removeApplicationName
public void removeApplicationName()
Removes the application name.
-
getSecurity
public int getSecurity()
Returns a security code which is one of the following values:- 0 if the SummaryInformation does not contain a
security field or if there is no security on the document. Use
PropertySet.wasNull()to distinguish between the two cases! - 1 if the document is password protected
- 2 if the document is read-only recommended
- 4 if the document is read-only enforced
- 8 if the document is locked for annotations
- Returns:
- The security code or
null
- 0 if the SummaryInformation does not contain a
security field or if there is no security on the document. Use
-
setSecurity
public void setSecurity(int security)
Sets the security code.- Parameters:
security- The security code to set.
-
removeSecurity
public void removeSecurity()
Removes the security code.
-
-