Scan a file from a given {@link InputStream}.

@param in
@param filename
@return An {@link ArrayList} of {@link VictimsRecord}s derrived from the
source. Embedded jars are a record on their own.
@throws IOException
160735
public static ArrayList<VictimsRecord> getRecords(InputStream in,
            String filename) throws IOException {
        ArrayList<VictimsRecord> records = new ArrayList<VictimsRecord>();
        Artifact artifact = Processor.process(in, filename);
        scanArtifact(artifact, new ArrayOutputStream(records));
        return records;

    }
1358191
public static BufferedImage read (InputStream in)
        throws IOException
    {
        return read(ByteBuffer.wrap(StreamUtil.toByteArray(in)));
    }
640292
public Map<String, Class<?>> scan(String classNamePattern) throws IOException {
        final Map<String, Class<?>> scannedClasses = new LinkedHashMap<>();
        scan(classNamePattern, scannedClasses);
        return scannedClasses;
    }
792374
public static byte[] md5(InputStream in) throws IOException {
		MD5InputStream md5in=new MD5InputStream(in);
		byte[] trashBuffer = BufferManager.getBytes();
		try {
			while(md5in.read(trashBuffer, 0, BufferManager.BUFFER_SIZE) != -1) {
				// Intentional empty block
			}
		} finally {
			BufferManager.release(trashBuffer, false);
		}
		return md5in.hash();
	}
1261513
public static InputStream fileAsStream(String filename) {
    File classpathFile = getClasspathFile(filename);
    return fileAsStream(classpathFile);
  }
118536
public InputStream getInputStream(String fileName, boolean create) throws MalformedURLException, IOException {
        try {
            GetKeyStoreInputStreamAction action = new GetKeyStoreInputStreamAction(fileName, create);
            return AccessController.doPrivileged(action);
        } catch (PrivilegedActionException e) {
            Exception ex = e.getException();
            FFDCFilter.processException(e, getClass().getName(), "getInputStream", new Object[] { fileName, Boolean.valueOf(create), this });
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "Exception opening keystore; " + ex);

            if (ex instanceof MalformedURLException)
                throw (MalformedURLException) ex;
            else if (ex instanceof IOException)
                throw (IOException) ex;

            throw new IOException(ex.getMessage());
        }
    }
1336766
public void scan(String classNamePattern, final Map<String, Class<?>> scannedClasses) throws IOException {
        scan(classNamePattern, scannedClasses::put);
    }
1299639
public static int copy(File in, File out) throws IOException {
		Assert.notNull(in, "No input File specified");
		Assert.notNull(out, "No output File specified");
		return copy(new BufferedInputStream(new FileInputStream(in)),
			new BufferedOutputStream(new FileOutputStream(out)));
	}
691668
@Override
   public InputStream lookupFile(String filename, ClassLoader cl) {
      try {
         return lookupFileStrict( filename, cl );
      }
      catch (FileNotFoundException e) {
         return null;
      }
   }
1019015
private List<String> readFile(String fileName) {
        List<String> result = Lists.newArrayList();

        try (BufferedReader bufRead = Files.newBufferedReader(Paths.get(fileName), options.atFileCharset)) {
            String line;
            // Read through file one line at time. Print line # and line
            while ((line = bufRead.readLine()) != null) {
                // Allow empty lines and # comments in these at files
                if (line.length() > 0 && !line.trim().startsWith("#")) {
                    result.add(line);
                }
            }
        } catch (IOException e) {
            throw new ParameterException("Could not read file " + fileName + ": " + e);
        }

        return result;
    }
971849
public static byte[] readFile(File input) throws IOException {
        return Files.readAllBytes(Paths.get(input.getAbsolutePath()));
    }
225645
public static byte[] toByteArray(InputStream in) throws IOException {
    checkNotNull(in, "in");
    try {
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      copy(in, out);
      return out.toByteArray();
    } finally {
      ensureClosed(in);
    }
  }
487326
public static void load( InputStream in ) throws IOException {
        if( in != null ) {
            prp.load( in );
        }
        try {
            prp.putAll( (java.util.Map)System.getProperties().clone() );
        } catch( SecurityException se ) {
            if( log.level > 1 )
                log.println( "SecurityException: jcifs will ignore System properties" );
        }
    }
245427
public static BufferedReader getReader(InputStream in, String charsetName) {
		return getReader(in, Charset.forName(charsetName));
	}
693254
public static int copy(Resource in, File out) throws IOException {
        assert in != null : "No input File specified";
        assert out != null : "No output File specified";
        return copy(new BufferedInputStream(in.getInputStream()),
            new BufferedOutputStream(Files.newOutputStream(out.toPath())));
    }
309005
public static byte[] getBytes(InputStream in) throws IOException {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        pipeStream(in, out, 4096);
        return out.toByteArray();
    }
883440
public static byte[] copyToByteArray(File in) throws IOException {
        assert in != null : "No input File specified";

        return copyToByteArray(new BufferedInputStream(new FileInputStream(in)));
    }