Java 8 FileImageOutputStream - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 FileImageOutputStream class.

This code example shows how to use the following methods:close, write
		ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
		String newFileName = servletContext.getRealPath("") + File.separator + "photocam" + File.separator + photo + ".png";
		 
		FileImageOutputStream imageOutput;
		try { 
			imageOutput = new FileImageOutputStream(new File(newFileName));
			imageOutput.write(data, 0, data.length);
			imageOutput.close();
             
            PushContextFactory.getDefault().getPushContext().push("/photoshare", photo + ".png");
		} 
        catch(Exception e) {
			throw new FacesException("Error in writing captured image."); 
		} 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:close, writeInts
This code example shows how to use the following methods:close, write
		ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
		String newFileName = servletContext.getRealPath("") + File.separator + "photocam" + File.separator + photo + ".png";
		 
		FileImageOutputStream imageOutput;
		try { 
			imageOutput = new FileImageOutputStream(new File(newFileName));
			imageOutput.write(data, 0, data.length);
			imageOutput.close();
		} 
        catch(Exception e) {
			throw new FacesException("Error in writing captured image."); 
		} 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:close
	 
				// Set compression quality, where 1 specifies minimum compression and maximum quality 
				iwp.setCompressionQuality(compressionQuality); // float between 0 and 1
			} 
			// Write the screen shot to file  
			output = new FileImageOutputStream(file);
			writer.setOutput(output);
			IIOImage image = new IIOImage(screenshot, null, null);
 
			writer.write(null, image, iwp);
		} catch (IOException e) {
			e.printStackTrace();
		} finally { 
			if (writer != null) {
				writer.dispose();
			} 
			if (output != null) {
				try { 
					output.close();
				} catch (IOException e) {

5
CodeRank
This code example shows how to use the following methods:
 
    public void store(BufferedImage editedImage, String type, File file) throws IOException {
        if (type.equals("tga")) {
            TGAImageWriterSpi spi = new TGAImageWriterSpi();
            TGAImageWriter wri = new TGAImageWriter(spi);
            wri.setOutput(new FileImageOutputStream(file));
            wri.write(editedImage);
        } else { 
            ImageIO.write(editedImage, type, file);
        } 
    } 
 
    public BufferedImage load(FileObject file) throws IOException, URISyntaxException {
        if (file.getExt().equalsIgnoreCase("tga")) {
            ImageInputStream in = new FileImageInputStream(new File(file.getURL().toURI()));
            TGAImageReaderSpi spi = new TGAImageReaderSpi();
            TGAImageReader rea = new TGAImageReader(spi);
            rea.setInput(in);
            return rea.read(0);
        } else { 
5
CodeRank
This code example shows how to use the following methods:
        File outputFile = GlobalTestConfig.getBeamTestDataOutputFile("ProductData");
        outputFile.mkdirs();
        File streamFile = new File(outputFile, "byte.img");
        streamFile.createNewFile();
        _inputStream = new FileImageInputStream(streamFile);
        _outputStream = new FileImageOutputStream(streamFile);
        assertNotNull(_inputStream);
        assertNotNull(_outputStream);
    } 
 
    @Override 
    protected void tearDown() { 
        try { 
            _inputStream.close();
            _outputStream.close();
        } catch (IOException e) {
        } 
        FileUtils.deleteTree(GlobalTestConfig.getBeamTestDataOutputDirectory()); 
    } 
 
4
CodeRank
This code example shows how to use the following methods:close
 
	@Test
	public void testAddCaelumLogoInPngImage() throws IOException{
		File baseImage = new File("src/test/basePngImage.png");
		File destImage = new File("src/test/basePngDone.png");
		ImageOutputStream image = new FileImageOutputStream(destImage);
		Utilities.getImageWithLogo(baseImage, image, "PNG", new File ("src/templatesCaelum/logo.png"));
		image.close();
		Assert.assertTrue(destImage.exists());
	} 
	 
	@Test
	public void testAddCaelumLogoInJpgImage() throws IOException{
		File baseImage = new File("src/test/baseJpgImage.jpg");
		File destImage = new File("src/test/baseJpgDone.jpg");
		ImageOutputStream image = new FileImageOutputStream(destImage);
		Utilities.getImageWithLogo(baseImage, image, "JPG", new File ("src/templatesCaelum/logo.png"));
		image.close();
		Assert.assertTrue(destImage.exists());
	} 
4
CodeRank
This code example shows how to use the following methods:
        File outputFile = GlobalTestConfig.getBeamTestDataOutputFile("ProductData");
        outputFile.mkdirs();
        File streamFile = new File(outputFile, "int.img");
        streamFile.createNewFile();
        _inputStream = new FileImageInputStream(streamFile);
        _outputStream = new FileImageOutputStream(streamFile);
        assertNotNull(_inputStream);
        assertNotNull(_outputStream);
    } 
 
    @Override 
    protected void tearDown() { 
        try { 
            _inputStream.close();
            _outputStream.close();
        } catch (IOException e) {
        } 
        FileUtils.deleteTree(GlobalTestConfig.getBeamTestDataOutputDirectory()); 
    } 
 
4
CodeRank
This code example shows how to use the following methods:close
This code example shows how to use the following methods:
        File outputFile = GlobalTestConfig.getBeamTestDataOutputFile("ProductData");
        outputFile.mkdirs();
        File streamFile = new File(outputFile, "uint.img");
        streamFile.createNewFile();
        _inputStream = new FileImageInputStream(streamFile);
        _outputStream = new FileImageOutputStream(streamFile);
        assertNotNull(_inputStream);
        assertNotNull(_outputStream);
    } 
 
    @Override 
    protected void tearDown() { 
        try { 
            _inputStream.close();
            _outputStream.close();
        } catch (IOException e) {
        } 
        FileUtils.deleteTree(GlobalTestConfig.getBeamTestDataOutputDirectory()); 
    } 
 
4
CodeRank
See Code Examples for Java 8 FileImageOutputStream Methods: