Package okhttp3.mock

Class ClasspathResources


  • public final class ClasspathResources
    extends java.lang.Object
    A helper class to provide responses from classpath sources
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.io.InputStream resource​(java.lang.ClassLoader classLoader, java.lang.String name)
      Loads the content from the given classpath resource
      static java.io.InputStream resource​(java.lang.String name)
      Loads the content from the given classpath resource
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • resource

        public static java.io.InputStream resource​(java.lang.String name)
        Loads the content from the given classpath resource
        Parameters:
        name - the name of the resource
        Returns:
        the content as an InputStream
      • resource

        public static java.io.InputStream resource​(java.lang.ClassLoader classLoader,
                                                   java.lang.String name)
        Loads the content from the given classpath resource
        Parameters:
        classLoader - the base classloader
        name - the name of the resource
        Returns:
        the content as an InputStream