Module methanol

Class Utils

java.lang.Object
com.github.mizosoft.methanol.internal.Utils

public class Utils extends Object
Miscellaneous utilities.
  • Field Details

    • BUFFER_SIZE

      public static final int BUFFER_SIZE
  • Method Details

    • isValidToken

      public static boolean isValidToken(CharSequence token)
    • isValidHeaderName

      public static boolean isValidHeaderName(String name)
    • requireValidToken

      @CanIgnoreReturnValue public static <S extends CharSequence> S requireValidToken(S token)
    • requireValidHeaderName

      @CanIgnoreReturnValue public static String requireValidHeaderName(String name)
    • requireValidHeaderValue

      @CanIgnoreReturnValue public static String requireValidHeaderValue(String value)
    • requireValidHeader

      public static void requireValidHeader(String name, String value)
    • requirePositiveDuration

      @CanIgnoreReturnValue public static Duration requirePositiveDuration(Duration duration)
    • requireNonNegativeDuration

      @CanIgnoreReturnValue public static Duration requireNonNegativeDuration(Duration duration)
    • copyRemaining

      public static int copyRemaining(ByteBuffer src, ByteBuffer dst)
    • copy

      public static ByteBuffer copy(ByteBuffer buffer)
    • systemMillisUtc

      public static Clock systemMillisUtc()
    • getDeepCompletionCause

      public static Throwable getDeepCompletionCause(Throwable t)
    • get

      public static <T> T get(Future<T> future) throws IOException, InterruptedException
      Throws:
      IOException
      InterruptedException
    • getIo

      public static <T> T getIo(Future<T> future) throws IOException
      Throws:
      IOException
    • escapeAndQuoteValueIfNeeded

      public static String escapeAndQuoteValueIfNeeded(String value)
      From RFC 7230 section 3.2.6:

      "A sender SHOULD NOT generate a quoted-pair in a quoted-string except where necessary to quote DQUOTE and backslash octets occurring within that string."

    • startsWithIgnoreCase

      public static boolean startsWithIgnoreCase(String source, String prefix)
    • toCompletionException

      public static CompletionException toCompletionException(Throwable t)
    • toInterruptedIOException

      public static InterruptedIOException toInterruptedIOException(InterruptedException e)
    • remaining

      public static long remaining(List<ByteBuffer> buffers)
    • remaining

      public static long remaining(ByteBuffer[] buffers)
    • hintsOf

      public static BodyAdapter.Hints hintsOf(@Nullable MediaType mediaType)
    • toStringIdentityPrefix

      public static String toStringIdentityPrefix(Object object)
    • forwardingObjectToString

      public static String forwardingObjectToString(Object forwardingObject, Object delegate)