Skip to content

Commit

Permalink
Avoid allocations from StompDecoder#unescape
Browse files Browse the repository at this point in the history
  • Loading branch information
dreis2211 committed Nov 7, 2022
1 parent aeb3566 commit 102cfef
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -264,9 +264,12 @@ private void readHeaders(ByteBuffer byteBuffer, StompHeaderAccessor headerAccess
* <a href="https://stomp.github.io/stomp-specification-1.2.html#Value_Encoding">"Value Encoding"</a>.
*/
private String unescape(String inString) {
StringBuilder sb = new StringBuilder(inString.length());
int pos = 0; // position in the old string
int index = inString.indexOf('\\');
if (index == -1) {
return inString;
}
int pos = 0; // position in the old string
StringBuilder sb = new StringBuilder(inString.length());

while (index >= 0) {
sb.append(inString, pos, index);
Expand Down

0 comments on commit 102cfef

Please sign in to comment.