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
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:close, writeInts
            imageOutputStream.flush();
            zipOutputStream.closeEntry();
            zipOutputStream.close();
        } else { 
            final File file = new File(levelDir, baseName);
            FileImageOutputStream outputStream = new FileImageOutputStream(file);
            outputStream.writeInts(data, 0, data.length);
            outputStream.close();
        } 
    } 
 
    private void writeImageProperties(int level, int dataType, int width, int height, int tileWidth, int tileHeight, int numXTiles, int numYTiles, PrintWriter printWriter) {
        printWriter.println("level      = " + level);
        printWriter.println("dataType   = " + dataType);
        printWriter.println("width      = " + width);
        printWriter.println("height     = " + height);
        printWriter.println("tileWidth  = " + tileWidth);
        printWriter.println("tileHeight = " + tileHeight);
        printWriter.println("numXTiles  = " + numXTiles);
        printWriter.println("numYTiles  = " + numYTiles);
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:close
 
	public static void write(BufferedImage img, String format, float DPI, File outFile) throws IOException {
				  
	    Iterator<ImageWriter> it = ImageIO.getImageWritersByFormatName(format);
	    ImageWriter writer = it.next();
	    FileImageOutputStream fios = new FileImageOutputStream(outFile);
	    writer.setOutput(fios);
	 
	    writeImage(writer, img, DPI);	
 
	    fios.close();
	} 
	 
	public static void writeImage(ImageWriter writer, BufferedImage img, double DPI) throws IOException {
		float xDPI = (float)DPI;
		float yDPI = (float)DPI;
 
	    ImageWriteParam writeParam = writer.getDefaultWriteParam();
	    RenderedImage ri = img;
	    // set the DPI 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 FileImageOutputStream Methods: