Skip to content

Commit 54e17ec

Browse files
committed
Loop optimization
1 parent 100e1bc commit 54e17ec

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/com/github/packageurl/PackageURL.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,11 @@ private static String uriEncode(final String source) {
473473
}
474474

475475
StringBuilder sb = new StringBuilder(length * 3);
476+
sb.append(source, 0, pos);
477+
478+
for (int i = pos; i < bytes.length; i++) {
479+
byte b = bytes[i];
476480

477-
for (byte b : bytes) {
478481
if (isUnreserved(b)) {
479482
sb.append((char) b);
480483
} else {

0 commit comments

Comments
 (0)