Java BufferedInputStream Create getStream(String resource)

Here you can find the source of getStream(String resource)

Description

Retrieves a resource using the current context classloader.

License

Open Source License

Parameter

Parameter Description
resource The resource's identifier.

Return

An input stream for the resource.

Declaration

public static InputStream getStream(String resource) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedInputStream;
import java.io.InputStream;

public class Main {
    /**//from  ww  w  .j a  va2  s . c o  m
     * Retrieves a resource using the current context classloader.
     * @param resource The resource's identifier.
     * @return An input stream for the resource.
     */
    public static InputStream getStream(String resource) {
        return new BufferedInputStream(
                Thread.currentThread().getContextClassLoader().getResourceAsStream(resource));
    }
}

Related

  1. getStream(byte[] bytes)
  2. getStream(final File file)
  3. getStream(final String string, final String codePage)
  4. getStream(InputStream is)
  5. getStream(String name)
  6. getStream(String string)
  7. getStream(String string, String codePage)
  8. getStreamFromString(String text)
  9. inputStreamBuffered(final File file)