Code example for InputStream

Methods: markSupported

0
			loadOutputCache(); 
		if (outputCache == null)
			return null; 
		InputStream inputStream = registerInputStream(outputCache
				.getNewInputStream()); 
		if (inputStream.markSupported())
			return inputStream;
		inputStream = registerInputStream(new BufferedInputStream(inputStream));
		return inputStream;
	} 
 
	private final InputStream registerInputStream(final InputStream inputStream) {
		inputStreamList.add(inputStream);
		return inputStream;
	} 
 
	public String getMD5Hash() throws NoSuchAlgorithmException, LimitException,
			IOException { 
		if (outputCache == null)
			loadOutputCache(); 
		if (outputCache == null)
			return null; 
		InputStream is = null;
		try { 
			is = getNewInputStream();
			return DigestUtils.md5Hex(is);
		} finally { 
			IOUtils.close(is);
		} 
	} 
 
	public long getSize() throws LimitException, IOException { 
		if (outputCache == null)
			loadOutputCache(); 
		if (outputCache == null)
			return 0; 
		return outputCache.getSize();
	} 
 
	public long getLimit() { 
		return limit;
	} 
 
	@Override 
	public void close() throws IOException { 
		for (InputStream inputStream : inputStreamList)
			IOUtils.closeQuietly(inputStream);
		inputStreamList.clear();
		for (File tmpFile : tempFiles)
			tmpFile.delete();
		tempFiles.clear();
	} 
 
	protected File getTempFile(String extension) throws IOException {
		File tempFile = File.createTempFile("oss", "." + extension);
		FileUtils.copyInputStreamToFile(getNewInputStream(), tempFile);
		tempFiles.add(tempFile);
		return tempFile;
	} 
 
	public String getOriginalFileName() {