-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use UnicodeUnescaper().translate() instead of unsecapeJava, use jacks…
…on instead of gson
- Loading branch information
Showing
3 changed files
with
87 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package UnUnicode; | ||
|
||
import com.fasterxml.jackson.core.JsonGenerator; | ||
import com.fasterxml.jackson.core.util.DefaultIndenter; | ||
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; | ||
import com.fasterxml.jackson.core.util.Separators; | ||
|
||
import java.io.IOException; | ||
|
||
|
||
public class BurpPrettyPrinter extends DefaultPrettyPrinter { | ||
|
||
public BurpPrettyPrinter() { | ||
_arrayIndenter = DefaultIndenter.SYSTEM_LINEFEED_INSTANCE; | ||
_objectIndenter = DefaultIndenter.SYSTEM_LINEFEED_INSTANCE; | ||
} | ||
|
||
public BurpPrettyPrinter(DefaultPrettyPrinter base) { | ||
super(base); | ||
} | ||
|
||
@Override | ||
public BurpPrettyPrinter createInstance() { | ||
if (getClass() != BurpPrettyPrinter.class) { | ||
throw new IllegalStateException("Failed `createInstance()`: " + getClass().getName() | ||
+ " does not override method; it has to"); | ||
} | ||
return new BurpPrettyPrinter(this); | ||
} | ||
|
||
@Override | ||
public BurpPrettyPrinter withSeparators(Separators separators) { | ||
this._separators = separators; | ||
this._objectFieldValueSeparatorWithSpaces = separators.getObjectFieldValueSeparator() + ""; | ||
return this; | ||
} | ||
|
||
@Override | ||
public void writeEndArray(JsonGenerator g, int nrOfValues) throws IOException { | ||
if (!_arrayIndenter.isInline()) { | ||
--_nesting; | ||
} | ||
if (nrOfValues > 0) { | ||
_arrayIndenter.writeIndentation(g, _nesting); | ||
} | ||
g.writeRaw(']'); | ||
} | ||
|
||
@Override | ||
public void writeEndObject(JsonGenerator g, int nrOfEntries) throws IOException { | ||
if (!_objectIndenter.isInline()) { | ||
--_nesting; | ||
} | ||
if (nrOfEntries > 0) { | ||
_objectIndenter.writeIndentation(g, _nesting); | ||
} | ||
g.writeRaw('}'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters