Skip to content

Commit 6900654

Browse files
committed
Added method without ident step
1 parent f45986c commit 6900654

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/main/java/com/github/underscore/U.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2805,6 +2805,10 @@ public static void streamXmlToJson(InputStream xmlInputStream, OutputStream json
28052805
jsonOutputStream.write(formattedJson.getBytes(StandardCharsets.UTF_8));
28062806
}
28072807

2808+
public static void streamXmlToJson(InputStream xmlInputStream, OutputStream jsonOutputStream) throws IOException {
2809+
streamXmlToJson(xmlInputStream, jsonOutputStream, Json.JsonStringBuilder.Step.TWO_SPACES);
2810+
}
2811+
28082812
public static byte[] removeBom(byte[] bytes) {
28092813
if ((bytes.length >= 3) && (bytes[0] == -17) && (bytes[1] == -69) && (bytes[2] == -65)) {
28102814
return Arrays.copyOfRange(bytes, 3, bytes.length);

src/test/java/com/github/underscore/UnderscoreTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ void testStreamXmlToJson_validXml_writesJson() throws IOException {
10941094
String xml = "<root><name>Test</name></root>";
10951095
InputStream xmlStream = new ByteArrayInputStream(xml.getBytes());
10961096
ByteArrayOutputStream jsonStream = new ByteArrayOutputStream();
1097-
U.streamXmlToJson(xmlStream, jsonStream, Json.JsonStringBuilder.Step.TWO_SPACES);
1097+
U.streamXmlToJson(xmlStream, jsonStream);
10981098
String jsonOutput = jsonStream.toString("UTF-8");
10991099
assertTrue(jsonOutput.contains("name"), "JSON output should contain 'name' field.");
11001100
assertTrue(jsonOutput.contains("Test"), "JSON output should contain 'Test' value.");

0 commit comments

Comments
 (0)