Returns a stream output, depending on the query parameters.

@param impl
implementation
@param path
path info

@return parameter map
342020
private StreamingOutput createOutput(final JaxRx impl, final ResourcePath path) {

        // check for command parameter
        String qu = path.getValue(QueryParameter.COMMAND);
        if (qu != null) {
            return impl.command(qu, path);
        }

        // check for run parameter
        qu = path.getValue(QueryParameter.RUN);
        if (qu != null) {
            return impl.run(qu, path);
        }

        // check for query parameter
        qu = path.getValue(QueryParameter.QUERY);
        if (qu != null) {
            return impl.query(qu, path);
        }

        // no parameter found
        return impl.get(path);
    }
273753
public static Properties loadClasspath(String path) throws IOException {
		InputStream input = PropUtils.class.getClassLoader().getResourceAsStream(path);
		Properties prop = null;
		try {
			prop = load(input);
		} finally {
			IOUtils.close(input);
		}
		return prop;
	}
1316240
@Override
  public StreamImpl stream()
    throws IOException
  {
    if (_stream == null) {
      _stream = new JniStream(this);
    }

    _stream.init();

    return _stream;
  }
874719
public static InputStream getResourceAsStream(String pPath) {
        for (ClassLoader loader : new ClassLoader[] {
                Thread.currentThread().getContextClassLoader(),
                ClassUtil.class.getClassLoader()
        } ) {
            if (loader != null) {
                InputStream is = loader.getResourceAsStream(pPath);
                if (is != null) {
                    return is;
                }
            }
        }
        return null;
    }
1144205
public static AiffData create(URL path) {
		try {
			return create(
				AudioSystem.getAudioInputStream(
					new BufferedInputStream(path.openStream())));
		} catch (Exception e) {
			org.lwjgl.LWJGLUtil.log("Unable to create from: " + path);
			e.printStackTrace();
			return null;
		}		
	}
940161
private void executeInt(String []path, LineMap lineMap)
    throws JavaCompileException, IOException
  {
    MemoryStream tempStream = new MemoryStream();
    WriteStreamOld error = new WriteStreamOld(tempStream);

    try {
      // String parent = javaPath.getParent().getNativePath();

      ArrayList<String> argList = new ArrayList<String>();
      argList.add("-d");
      argList.add(_compiler.getClassDirName());
      if (_compiler.getEncoding() != null) {
        String encoding = Encoding.getJavaName(_compiler.getEncoding());
        if (encoding != null && ! encoding.equals("ISO8859_1")) {
          argList.add("-encoding");
          argList.add(_compiler.getEncoding());
        }
      }

      argList.add("-classpath");
      argList.add(_compiler.getClassPath());

      ArrayList<String> args = _compiler.getArgs();
      if (args != null)
        argList.addAll(args);

      for (int i = 0; i < path.length; i++) {
        PathImpl javaPath = _compiler.getSourceDir().lookup(path[i]);
        argList.add(javaPath.getNativePath());
      }

      if (log.isLoggable(Level.FINER)) {
        CharBuffer msg = new CharBuffer();
        msg.append("javac(int)");
        for (int i = 0; i < argList.size(); i++) {
          if (argList.get(i).equals("-classpath")
              && ! log.isLoggable(Level.FINEST)) {
            i++;
            continue;
          }

          msg.append(" ");
          msg.append(argList.get(i));
        }

        log.finer(msg.toString());
      }

      String []argArray = argList.toArray(new String[argList.size()]);

      int status = -1;
      
      Thread thread = Thread.currentThread();
      ClassLoader oldLoader = thread.getContextClassLoader();

      // env = _internalLoader;


      try {
        thread.setContextClassLoader(_envClassLoader);
        
        if (_javac == null)
          throw new ConfigException(L.l("javac compiler is not available in {0}. Check that you are using the JDK, not the JRE.",
                                        System.getProperty("java.runtime.name")
                                        + " " + System.getProperty("java.runtime.version")));
        
        status = _javac.run(null, error, error, argArray);
      
        error.close();
        tempStream.close();
      } finally {
        thread.setContextClassLoader(oldLoader);
      }

      ReadStreamOld read = tempStream.openReadAndSaveBuffer();
      JavacErrorParser parser = new JavacErrorParser(this, path[0], _compiler.getEncoding());

      String errors = parser.parseErrors((InputStream) read, lineMap);
      read.close();

      if (errors != null)
        errors = errors.trim();

      if (log.isLoggable(Level.FINE)) {
        read = tempStream.openReadAndSaveBuffer();
        CharBuffer cb = new CharBuffer();
        int ch;
        while ((ch = read.read()) >= 0) {
          cb.append((char) ch);
        }
        read.close();

        log.fine(cb.toString());
      }
      else if (status == 0 && errors != null && ! errors.equals("")) {
        final String msg = errors;

        new com.caucho.v5.loader.ClassLoaderContext(_compiler.getClassLoader()) {
          public void run()
          {
            log.warning(msg);
          }
        };
      }

      if (status != 0)
        throw new JavaCompileException(errors);
    } finally {
      tempStream.destroy();
    }
  }
1172259
public Stream<Label> getLabelsStream(Object projectIdOrPath) throws GitLabApiException {
        return (getLabels(projectIdOrPath, getDefaultPerPage()).stream());
    }
1105365
public Response get(String path, Map<String, String> params) throws IOException, RESTException {
        return get(path, params, null);
    }
903408
public HttpPut createPutMethod(final String path, final Map<String, List<String>> params) {
        return new HttpPut(repositoryURL + path + queryString(params));
    }
650158
protected InputStream getStream (String bundle, String path, String query)
        throws IOException
    {
        // we can only do this with PNGs
        if (!path.endsWith(".png")) {
            log.warning("Requested sub-tile of non-PNG resource",
                "bundle", bundle, "path", path, "dims", query);
            return _rmgr.getResource(bundle, path);
        }

        // parse the query string
        String[] bits = StringUtil.split(query, "&");
        int width = -1, height = -1, tidx = -1;
        HashMap<String, String> zations = null;
        try {
            for (String bit : bits) {
                if (bit.startsWith("width=")) {
                    width = Integer.parseInt(bit.substring(6));
                } else if (bit.startsWith("height=")) {
                    height = Integer.parseInt(bit.substring(7));
                } else if (bit.startsWith("tile=")) {
                    tidx = Integer.parseInt(bit.substring(5));
                } else if (bit.startsWith("zation=")) {
                    String[] zation = bit.substring(7).split(":");
                    if (zations == null) {
                        zations = Maps.newHashMap();
                    }

                    zations.put(zation[0], zation[1]);
                }
            }
        } catch (NumberFormatException nfe) {
        }
        if (width <= 0 || height <= 0 || tidx < 0) {
            log.warning("Bogus sub-image dimensions",
                "bundle", bundle, "path", path, "dims", query);
            throw new FileNotFoundException(path);
        }

        // locate the tile image, then write that subimage back out in PNG format into memory and
        // return an input stream for that
        BufferedImage src = StringUtil.isBlank(bundle) ?
            _rmgr.getImageResource(path) : _rmgr.getImageResource(bundle, path);
        Rectangle trect = GeomUtil.getTile(src.getWidth(), src.getHeight(), width, height, tidx);
        BufferedImage tile = src.getSubimage(trect.x, trect.y, trect.width, trect.height);
        if (zations != null) {
            ColorPository pository = ColorPository.loadColorPository(_rmgr);
            ArrayList<Colorization> colorizations = Lists.newArrayList();
            for (Map.Entry<String, String> entry : zations.entrySet()) {
                String zClass = entry.getKey();
                String zColor = entry.getValue();

                Colorization zation = null;

                // First try looking if we got a number
                try {
                    zation = pository.getColorization(zClass, Integer.parseInt(zColor));
                } catch (NumberFormatException nfe) { }

                // If that didn't work, try it as a zation name
                if (zation == null) {
                    zation = pository.getColorization(zClass, zColor);
                }

                if (zation == null) {
                    log.warning("Couldn't figure out requested zation",
                        "class", zClass, "color", zColor);
                } else {
                    colorizations.add(zation);
                }

            }

            tile = ImageUtil.recolorImage(tile,
                colorizations.toArray(new Colorization[colorizations.size()]));
        }

        ByteArrayOutInputStream data = new ByteArrayOutInputStream();
        ImageIO.write(tile, "PNG", data);
        return data.getInputStream();
    }
1091061
protected StreamSource resolveRepositoryURI(String path)
            throws TransformerException {

        StreamSource resolvedSource = null;

        try {
            if (path != null) {
                URL url = new URL(path);
                InputStream in = url.openStream();
                if (in != null) {
                    resolvedSource = new StreamSource(in);
                }
            } else {
                throw new TransformerException("Resource does not exist. \""
                        + path + "\" is not accessible.");
            }
        } catch (MalformedURLException mfue) {
            throw new TransformerException("Error accessing resource using servlet context: "
                                         + path,
                                           mfue);
        } catch (IOException ioe) {
            throw new TransformerException("Unable to access resource at: "
                                         + path,
                                         ioe);
        }
        return resolvedSource;
    }
1009068
public static IResourceStream getResourceStream(final WebApplication application,
		final String path, final String contentType) throws IOException
	{
		return new ByteArrayResourceStreamWriter()
		{
			private static final long serialVersionUID = 1L;

			@Override
			public String getContentType()
			{
				return contentType;
			}

			@Override
			protected byte[] load() throws IOException
			{
				final String realPath = ApplicationExtensions.getRealPath(application, path);
				final File file = new File(realPath);
				final byte[] data = Files.readBytes(file);
				return data;
			}
		};
	}
104357
public void get(String url, OutputStream out) throws IOException {
        InputStream in = get(url);
        StreamUtility.pipeStream(in, out, 4096);
    }
1093136
public InputStream getResourceAsStream( String path ) {
        Object in = null;
        if ( externalClassLoader != null )
            // classloader wants no leading slash
            in = externalClassLoader.getResourceAsStream( path.substring(1) );
        if ( in == null )
            return Interpreter.class.getResourceAsStream( path );

        return (InputStream) in;
    }
1188983
@Override protected AutoBuffer writeAll_impl(AutoBuffer ab) {
    for (Key<CompressedTree>[] ks : _output._treeKeys)
      for (Key<CompressedTree> k : ks)
        ab.putKey(k);
    for (Key<CompressedTree>[] ks : _output._treeKeysAux)
      for (Key<CompressedTree> k : ks)
        ab.putKey(k);
    return super.writeAll_impl(ab);
  }
1161103
public InputStream getResourceAsStream(String pPath) {
        //throws MalformedURLException {
        String path = pPath;

        if (pPath != null && !pPath.startsWith("/")) {
            path = getContextPath() + pPath;
        }

        return pageContext.getServletContext().getResourceAsStream(path);
    }
1286997
public InputStream getInputStream() throws IOException, RepositoryException
   {
      final PipedInputStream pin = new PipedInputStream();
      final PipedOutputStream pout = new PipedOutputStream(pin);

      try
      {

         new Thread()
         {

            /*
             * (non-Javadoc)
             * 
             * @see java.lang.Thread#run()
             */
            public void run()
            {
               try
               {
                  if (isSystem)
                  {
                     node.getSession().exportSystemView(node.getPath(), pout, false, false);
                  }
                  else
                  {
                     node.getSession().exportDocumentView(node.getPath(), pout, false, false);
                  }
               }
               catch (Exception e)
               {
                  if (LOG.isTraceEnabled())
                  {
                     LOG.trace("An exception occurred: " + e.getMessage());
                  }
               }
               finally
               {
                  try
                  {
                     pout.flush();
                     pout.close();
                  }
                  catch (Exception e)
                  {
                     if (LOG.isTraceEnabled())
                     {
                        LOG.trace("An exception occurred: " + e.getMessage());
                     }
                  }
               }
            }

         }.start();

         return pin;
      }
      catch (Exception e)
      {
         LOG.error(e.getLocalizedMessage(), e);
         throw new IOException("can't get input stream", e);
      }

   }