Skip to content

Commit f669cec

Browse files
committed
add password support
1 parent 9051507 commit f669cec

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

poi-scratchpad/src/main/java/org/apache/poi/hwpf/extractor/WordExtractor.java

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,18 @@ public final class WordExtractor implements POIOLE2TextExtractor {
4747
* InputStream containing the word file
4848
*/
4949
public WordExtractor( InputStream is ) throws IOException {
50-
this(HWPFDocumentCore.verifyAndBuildPOIFS(is ) );
50+
this(HWPFDocumentCore.verifyAndBuildPOIFS(is));
51+
}
52+
53+
/**
54+
* Create a new Word Extractor
55+
*
56+
* @param is InputStream containing the word file
57+
* @param password as a char array (can be null)
58+
* @since 6.0.0
59+
*/
60+
public WordExtractor( InputStream is, char[] password ) throws IOException {
61+
this(HWPFDocumentCore.verifyAndBuildPOIFS(is), password);
5162
}
5263

5364
/**
@@ -60,10 +71,37 @@ public WordExtractor( POIFSFileSystem fs ) throws IOException {
6071
this( new HWPFDocument( fs ) );
6172
}
6273

74+
/**
75+
* Create a new Word Extractor
76+
*
77+
* @param fs POIFSFileSystem containing the word file
78+
* @param password as a char array (can be null)
79+
* @since 6.0.0
80+
*/
81+
public WordExtractor( POIFSFileSystem fs, char[] password ) throws IOException {
82+
this( new HWPFDocument( fs, password ) );
83+
}
84+
85+
/**
86+
* Create a new Word Extractor
87+
*
88+
* @param dir DirectoryNode containing the word file
89+
*/
6390
public WordExtractor( DirectoryNode dir ) throws IOException {
6491
this( new HWPFDocument( dir ) );
6592
}
6693

94+
/**
95+
* Create a new Word Extractor
96+
*
97+
* @param dir DirectoryNode containing the word file
98+
* @param password as a char array (can be null)
99+
* @since 6.0.0
100+
*/
101+
public WordExtractor( DirectoryNode dir, char[] password ) throws IOException {
102+
this( new HWPFDocument( dir, password ) );
103+
}
104+
67105
/**
68106
* Create a new Word Extractor
69107
*

0 commit comments

Comments
 (0)