com.marklogic.io

## Class IOHelper

- java.lang.Object
- - com.marklogic.io.IOHelper

-     public class IOHelper
      extends java.lang.Object

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static byte[]` | `byteArrayFromStream(java.io.InputStream inputStream)`
    `static java.lang.String` | `bytesToHex(byte[] bytes)`
    `static java.lang.String` | `genericExceptionMessage(java.lang.Exception e)`
    `static java.lang.String` | `literalStringFromReader(java.io.Reader reader)`
    `static java.lang.String` | `literalStringFromStream(java.io.InputStream is)`
    `static java.io.BufferedReader` | `newBufferedUtf8Reader(java.io.InputStream stream)`
    `static java.io.BufferedReader` | `newReader(java.lang.String value)`
    `static java.io.InputStream` | `newStream(java.lang.String value)`
    `static java.io.InputStream` | `newUtf8Stream(java.lang.String s)`
    `static java.io.Reader` | `newUtf8StreamReader(java.io.InputStream is)`
    `static java.lang.String` | `stringFromReader(java.io.BufferedReader br)`
    `static java.lang.String` | `stringFromStream(java.io.InputStream is)`
    `static java.lang.String` | `urlDecodeString(java.lang.String value)`
    `static java.lang.String` | `urlEncodeString(java.lang.String s, java.lang.String encoding)` Implement a "soft" encode, which hex encodes non-printable chars, '+', '&' and '=' but not other special chars.
    `static void` | `urlEncodeStringToStringBuffer(java.lang.String s, java.lang.StringBuffer sb, java.lang.String encoding)` This is a "quick" URL encoder.
    `static void` | `urlEncodeToStringBuffer(java.lang.StringBuffer sb, java.lang.String value)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### newReader

          public static java.io.BufferedReader newReader(java.lang.String value)

    - #### newStream

          public static java.io.InputStream newStream(java.lang.String value)

    - #### literalStringFromReader

          public static java.lang.String literalStringFromReader(java.io.Reader reader)
                                                          throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### literalStringFromStream

          public static java.lang.String literalStringFromStream(java.io.InputStream is)
                                                          throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### stringFromReader

          public static java.lang.String stringFromReader(java.io.BufferedReader br)
                                                   throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### stringFromStream

          public static java.lang.String stringFromStream(java.io.InputStream is)
                                                   throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### newUtf8Stream

          public static java.io.InputStream newUtf8Stream(java.lang.String s)

    - #### newUtf8StreamReader

          public static java.io.Reader newUtf8StreamReader(java.io.InputStream is)

    - #### newBufferedUtf8Reader

          public static java.io.BufferedReader newBufferedUtf8Reader(java.io.InputStream stream)

    - #### byteArrayFromStream

          public static byte[] byteArrayFromStream(java.io.InputStream inputStream)
                                            throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### genericExceptionMessage

          public static java.lang.String genericExceptionMessage(java.lang.Exception e)

    - #### urlDecodeString

          public static java.lang.String urlDecodeString(java.lang.String value)

    - #### urlEncodeToStringBuffer

          public static void urlEncodeToStringBuffer(java.lang.StringBuffer sb,
                                                     java.lang.String value)

    - #### urlEncodeString

          public static java.lang.String urlEncodeString(java.lang.String s,
                                                         java.lang.String encoding)
                                                  throws java.io.UnsupportedEncodingException

      Implement a "soft" encode, which hex encodes non-printable chars, '+', '&' and '=' but not other special chars.
      Parameters:
        `s` - string to be "soft" encoded.
        `encoding` -
      Returns:
        the string after the "soft" encoding has been applied.
      Throws:
        `java.io.UnsupportedEncodingException`

    - #### urlEncodeStringToStringBuffer

          public static void urlEncodeStringToStringBuffer(java.lang.String s,
                                                           java.lang.StringBuffer sb,
                                                           java.lang.String encoding)
                                                    throws java.io.UnsupportedEncodingException

      This is a "quick" URL encoder. If the string contains only ascii printable chars, then a lightweight routine is used to encode the string. Otherwise, the standard library URL encoder is used.
      Parameters:
        `s` - string to be "soft" encoded.
        `sb` - A StringBuffer to which the encoded characters will be appended.
        `encoding` -
      Throws:
        `java.io.UnsupportedEncodingException`

    - #### bytesToHex

          public static java.lang.String bytesToHex(byte[] bytes)

Copyright © 2025 MarkLogic Corporation. All Rights Reserved.

Complete online documentation for MarkLogic Server, XQuery and related components may be found at developer.marklogic.com