Gets an input stream by class.

@param koanClass the koan class
@return the input stream relating to the class file
13721
public static FileInputStream getInputStreamByClass(Class<?> koanClass) {

        FileInputStream in = null;
        try {
            in = new FileInputStream(getKoanFileLocation(koanClass));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        return in;
    }
81954
public InputStream getInputStream() throws IOException {
        if (null == inputStream) {
            if (readFromCache) {
                inputStream = new FileInputStream(cacheFile.toFile());
            } else {
                WriteCacheFileInputStream wis = new WriteCacheFileInputStream(delegate.getInputStream(),
                        new FileOutputStream(cacheFile.toFile()));
                wis.onInputStreamClose(() -> {
                    try {
                        final int responseCode = delegate.getResponseCode();
                        if (responseCode == HTTP_OK) {
                            cache.saveCachedDataInfo(cacheFile, cachedDataInfo);
                        } else {
                            if (logger.isWarnEnabled()) {
                                logger.warn("not caching because of response code {}: {}", responseCode, getURL());
                            }
                        }
                    } catch (final IOException e) {
                        if (logger.isWarnEnabled()) {
                            logger.warn("cannot retrieve response code");
                        }
                    }
                });
                inputStream = wis;
            }
        }
        return inputStream;
    }
33701
public JavaClass parse() throws IOException {
        JavaClass jclass = classParser.parse();
        Repository.addClass(jclass);
        return jclass;
    }
683208
public static Class<?> read(ObjectInput in) throws java.io.IOException {
        byte dim;
        Class<?> cl;
        String name;

        dim = in.readByte();
        if (dim == -1) {
            return null;
        } else {
            name = in.readUTF();
            cl = classFind(name);
            if (cl == null) {
                throw new RuntimeException("can't load class " + name);
            }

            while (dim-- > 0) {
                cl = net.oneandone.sushi.util.Arrays.getArrayClass(cl);
            }
            return cl;
        }
    }
1150512
private static InputStream getStreamFromClassPath(
      final String normalizedPath) {
    InputStream dictInputStream = null;
    final String[] dictPaths = normalizedPath.split("src/main/resources");
    if (dictPaths.length == 2) {
      dictInputStream = IOUtils.class.getClassLoader()
          .getResourceAsStream(dictPaths[1]);
    } else {
      final String[] windowsPaths = normalizedPath
          .split("src\\\\main\\\\resources\\\\");
      if (windowsPaths.length == 2) {
        dictInputStream = IOUtils.class.getClassLoader()
            .getResourceAsStream(windowsPaths[1]);
      }
    }
    return dictInputStream;
  }
144175
@Override
    public synchronized InputStream getInputStream() throws IOException {
        if (connected == false) {
            // Implicitly open the connection if it has not yet been done so.
            connect();
        }

        Object token = ThreadIdentityManager.runAsServer();
        try {
            if (inputStream == null) {
                if ("".equals(archivePath)) {
                    inputStream = new FileInputStream(urlTargetFile);
                } else {
                    inputStream = new FilterZipFileInputStream(urlTargetFile, archivePath);
                }
            }
        } finally {
            ThreadIdentityManager.reset(token);
        }

        return inputStream;
    }
1223470
public static Class<?>[] readClasses(ObjectInput in)
            throws java.io.IOException, ClassNotFoundException {
        int i, len;
        Class<?>[] result;

        len = in.readByte();
        result = new Class[len];
        for (i = 0; i < len; i++) {
            result[i] = read(in);
        }
        return result;
    }
59749
protected InputStream getInputStreamFromClasspath (final String fullyQualifiedPath)
    {
        return AccessController.doPrivileged(new PrivilegedAction<InputStream>() {
            public InputStream run () {
                return _loader.getResourceAsStream(fullyQualifiedPath);
            }
        });
    }
349873
public CtClass getCtClass() {
        if (ctClass == null && fileName.endsWith(".class")) {
            try {
                ctClass = ClassPool.getDefault().makeClass(getFileStream());
            } catch (IOException e) {
                logger.error("make class error", e);
            }
        }
        return ctClass;
    }
1312184
public static InputStream asStream(Class<?> contextClass, String resourceName) throws IOException {
		return Resources.getResource(contextClass, resourceName).openStream();
	}
607735
@Override
    public InputStream getInputStream() {
        try {
            return property.getBinary().getStream();
        } catch (final RepositoryException e) {
            throw new RepositoryRuntimeException(e);
        }
    }
680619
@Override
   public InputStream getInputStream() throws IOException
   {
      if (!connected)
         connect();

      try
      {
         return nodeRepresentation.getInputStream();
      }
      catch (IOException e)
      {
         //e.printStackTrace();
         throw new IOException("can't get input stream", e);
      }
      catch (RepositoryException e)
      {
         //e.printStackTrace();
         throw new IOException("can't get input stream", e);
      }
   }
946577
@Override
    public InputStream getInputStream() throws IOException {
        if (!exists()) {
            throw new FileNotFoundException(getPath() + " (no such file or directory)");
        }
        if (Files.isDirectory(this.path)) {
            throw new FileNotFoundException(getPath() + " (is a directory)");
        }
        return Files.newInputStream(this.path);
    }
1304747
@Override
    public InputStream get(String path) throws IOException {
        InputStream stream = _cl.getResourceAsStream(rewritePath(path));
        if (stream == null) {
            throw new FileNotFoundException("Not found in classpath: " + path);
        } else {
            return stream;
        }
    }
913288
public JavaClass parse(InputStream is)
    throws IOException
  {
    _is = is;

    if (_loader == null)
      _loader = new JavaClassLoader();
    
    if (_class == null)
      _class = new JavaClass(_loader);

    _cp = _class.getConstantPool();
    
    parseClass();

    return _class;
  }
414745
protected InputStream getInputStream()
        throws IOException
    {
        if (is == null && server != null)
            is = server.readChannel(channel);

        return is;
    }
1205773
public  InputStream getInputStream(File f)
	throws IOException
	{

		// use the magic numbers to determine the compression type,
		// use file extension only as 2nd choice

		int magic = 0;


		InputStream test = getInputStreamFromFile(f);
		magic = getMagicNumber(test);
		test.close();


		InputStream inputStream = null;

		String fileName = f.getName();

		if (magic == UncompressInputStream.LZW_MAGIC ) {
			// a Z compressed file
			return openCompressedFile(f);
		}

		else if (magic == GZIP_MAGIC ) {
			return openGZIPFile(f);
		}

		else if ( fileName.endsWith(".gz")) {
			return openGZIPFile(f);
		}

		else if ( fileName.endsWith(".zip")){

			ZipFile zipfile = new ZipFile(f);

			// stream to first entry is returned ...
			ZipEntry entry;
			Enumeration<? extends ZipEntry> e = zipfile.entries();
			if ( e.hasMoreElements()){
				entry = e.nextElement();
				inputStream = zipfile.getInputStream(entry);
			} else {
				throw new IOException ("Zip file has no entries");
			}

		}

		else if ( fileName.endsWith(".jar")) {

			JarFile jarFile = new JarFile(f);

			// stream to first entry is returned
			JarEntry entry;
			Enumeration<JarEntry> e = jarFile.entries();
			if ( e.hasMoreElements()){
				entry = e.nextElement();
				inputStream = jarFile.getInputStream(entry);
			} else {
				throw new IOException ("Jar file has no entries");
			}
		}

		else if ( fileName.endsWith(".Z")) {
			// unix compressed
			return openCompressedFile(f);

		}

		else {

			// no particular extension found, assume that it is an uncompressed file
			inputStream = getInputStreamFromFile(f);
		}

		return inputStream;
	}