Package org.apache.poi.xwpf
Class XWPFParser
java.lang.Object
org.apache.poi.xwpf.XWPFParser
Methods that wrap
XWPFDocument parsing functionality.
One difference is that the methods in this class try to
throw XWPFReadException or IOException instead of RuntimeException.
You can still get an Errors like an OutOfMemoryError.- Since:
- 5.5.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic XWPFDocumentParse the given InputStream and return a newXWPFDocumentinstance.static XWPFDocumentparse(InputStream stream) Parse the given InputStream and return a newXWPFDocumentinstance.static XWPFDocumentparse(InputStream stream, boolean closeStream) Parse the given InputStream and return a newXWPFDocumentinstance.static XWPFDocumentparse(OPCPackage pkg) Parse the givenOPCPackageand return a newXWPFDocumentinstance.static XWPFDocumentparse(PackagePart packagePart) Parse the givenPackagePartand return a newXWPFDocumentinstance.
-
Method Details
-
parse
Parse the given InputStream and return a newXWPFDocumentinstance.- Parameters:
stream- the data to parse (will be closed after parsing)- Returns:
- a new
XWPFDocumentinstance - Throws:
XWPFReadException- if an error occurs while reading the fileIOException- if an I/O error occurs while reading the file
-
parse
public static XWPFDocument parse(InputStream stream, boolean closeStream) throws XWPFReadException, IOException Parse the given InputStream and return a newXWPFDocumentinstance.- Parameters:
stream- the data to parsecloseStream- whether to close the InputStream after parsing- Returns:
- a new
XWPFDocumentinstance - Throws:
XWPFReadException- if an error occurs while reading the fileIOException- if an I/O error occurs while reading the file
-
parse
Parse the given InputStream and return a newXWPFDocumentinstance.- Parameters:
file- to parse- Returns:
- a new
XWPFDocumentinstance - Throws:
XWPFReadException- if an error occurs while reading the fileIOException- if an I/O error occurs while reading the file
-
parse
Parse the givenOPCPackageand return a newXWPFDocumentinstance.- Parameters:
pkg- to parse- Returns:
- a new
XWPFDocumentinstance - Throws:
XWPFReadException- if an error occurs while reading the fileIOException- if an I/O error occurs while reading the file
-
parse
Parse the givenPackagePartand return a newXWPFDocumentinstance.- Parameters:
packagePart- to parse- Returns:
- a new
XWPFDocumentinstance - Throws:
XWPFReadException- if an error occurs while reading the fileIOException- if an I/O error occurs while reading the file
-