Skip to content

Commit

Permalink
4.x: Remove unused code from io.helidon.http.Utils
Browse files Browse the repository at this point in the history
  • Loading branch information
Captain1653 committed Dec 29, 2024
1 parent 51d07df commit 2601666
Showing 1 changed file with 1 addition and 35 deletions.
36 changes: 1 addition & 35 deletions http/http/src/main/java/io/helidon/http/Utils.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2023 Oracle and/or its affiliates.
* Copyright (c) 2018, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,8 +16,6 @@

package io.helidon.http;

import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -26,8 +24,6 @@
* Internal utility methods.
*/
final class Utils {
static final Runnable EMPTY_RUNNABLE = () -> {
};

private Utils() {
}
Expand Down Expand Up @@ -80,36 +76,6 @@ static List<String> tokenize(char separator, String quoteChars, boolean includeE
return result;
}

/**
* Unwrap from double-quotes - if exists.
*
* @param str string to unwrap.
* @return unwrapped string.
*/
static String unwrap(String str) {
if (str.length() >= 2 && '"' == str.charAt(0) && '"' == str.charAt(str.length() - 1)) {
return str.substring(1, str.length() - 1);
}
return str;
}

/**
* Appends the content of the given byte buffer into the given output stream.
*
* @param out the stream where to append the byte buffer
* @param byteBuffer the byte buffer to append to the stream
* @throws java.io.IOException in case of an IO problem
*/
static void write(ByteBuffer byteBuffer, OutputStream out) throws IOException {
if (byteBuffer.hasArray()) {
out.write(byteBuffer.array(), byteBuffer.arrayOffset() + byteBuffer.position(), byteBuffer.remaining());
} else {
byte[] buff = new byte[byteBuffer.remaining()];
byteBuffer.get(buff);
out.write(buff);
}
}

/**
* Convert the given byte buffer to a byte array.
* @param byteBuffer byte buffer
Expand Down

0 comments on commit 2601666

Please sign in to comment.