Skip to content

Commit 777677d

Browse files
committed
Added JsonFactory._streamFromFile(...) to help testing #3455
1 parent 0190c3a commit 777677d

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/main/java/com/fasterxml/jackson/core/JsonFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ public JsonFactory setCodec(ObjectCodec oc) {
10261026
public JsonParser createParser(File f) throws IOException, JsonParseException {
10271027
// true, since we create InputStream from File
10281028
IOContext ctxt = _createContext(_createContentReference(f), true);
1029-
InputStream in = new FileInputStream(f);
1029+
InputStream in = _streamFromFile(f);
10301030
return _createParser(_decorate(in, ctxt), ctxt);
10311031
}
10321032

src/main/java/com/fasterxml/jackson/core/TokenStreamFactory.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,9 @@ public abstract class TokenStreamFactory
178178
protected OutputStream _createDataOutputWrapper(DataOutput out) {
179179
return new DataOutputAsStream(out);
180180
}
181+
181182
/**
182-
* Helper methods used for constructing an optimal stream for
183+
* Helper method used for constructing an optimal stream for
183184
* parsers to use, when input is to be read from an URL.
184185
* This helps when reading file content via URL.
185186
*
@@ -210,4 +211,14 @@ protected InputStream _optimizedStreamFromURL(URL url) throws IOException {
210211
}
211212
return url.openStream();
212213
}
214+
215+
/**
216+
* Helper methods used for constructing an {@link InputStream} for
217+
* parsers to use, when input is to be read from given {@link File}.
218+
*
219+
* @since 2.14
220+
*/
221+
protected InputStream _streamFromFile(File f) throws IOException {
222+
return new FileInputStream(f);
223+
}
213224
}

0 commit comments

Comments
 (0)