public final class XWPFParser extends Object
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.| Modifier and Type | Method and Description |
|---|---|
static XWPFDocument |
parse(File file)
Parse the given InputStream and return a new
XWPFDocument instance. |
static XWPFDocument |
parse(InputStream stream)
Parse the given InputStream and return a new
XWPFDocument instance. |
static XWPFDocument |
parse(InputStream stream,
boolean closeStream)
Parse the given InputStream and return a new
XWPFDocument instance. |
static XWPFDocument |
parse(OPCPackage pkg)
Parse the given
OPCPackage and return a new XWPFDocument instance. |
static XWPFDocument |
parse(PackagePart packagePart)
Parse the given
PackagePart and return a new XWPFDocument instance. |
public static XWPFDocument parse(InputStream stream) throws XWPFReadException, IOException
XWPFDocument instance.stream - the data to parse (will be closed after parsing)XWPFDocument instanceXWPFReadException - if an error occurs while reading the fileIOException - if an I/O error occurs while reading the filepublic static XWPFDocument parse(InputStream stream, boolean closeStream) throws XWPFReadException, IOException
XWPFDocument instance.stream - the data to parsecloseStream - whether to close the InputStream after parsingXWPFDocument instanceXWPFReadException - if an error occurs while reading the fileIOException - if an I/O error occurs while reading the filepublic static XWPFDocument parse(File file) throws XWPFReadException, IOException
XWPFDocument instance.file - to parseXWPFDocument instanceXWPFReadException - if an error occurs while reading the fileIOException - if an I/O error occurs while reading the filepublic static XWPFDocument parse(OPCPackage pkg) throws XWPFReadException, IOException
OPCPackage and return a new XWPFDocument instance.pkg - to parseXWPFDocument instanceXWPFReadException - if an error occurs while reading the fileIOException - if an I/O error occurs while reading the filepublic static XWPFDocument parse(PackagePart packagePart) throws XWPFReadException, IOException
PackagePart and return a new XWPFDocument instance.packagePart - to parseXWPFDocument instanceXWPFReadException - if an error occurs while reading the fileIOException - if an I/O error occurs while reading the file