String parent = new File(dest.getAbsolutePath()).getParent(); File parentDir = new File(parent); if(!parentDir.exists()) parentDir.mkdirs(); OutputStream output = null; try { output = new BufferedOutputStream( new FileOutputStream( dest ) ); copyStream(input, output); } catch(IOException ex) { logger.log(Level.SEVERE, ex.getMessage(), ex); } finally { if( input != null ) input.close(); if( output != null ) output.close(); }
output = new BufferedOutputStream( new FileOutputStream( dest ) ); copyStream( input, output );
	public void writeImage(File dest) throws IOException	{		if( source == IImage.INVALID_IMAGE )		{			logger.log(Level.SEVERE, "image source {0} is not valid!", id); //$NON-NLS-1$			return;		}				InputStream input = null;		if(in!=null)		{			input = in;		}		else if(data!=null)		{			input = new ByteArrayInputStream( data );		}		else		{			logger.log(Level.SEVERE, "image source {0} is not found!", id); //$NON-NLS-1$		}		if(!dest.exists())		{						String parent = new File(dest.getAbsolutePath()).getParent();			File parentDir = new File(parent);			if(!parentDir.exists())				parentDir.mkdirs();			OutputStream output = null;			try			{				output = new BufferedOutputStream( new FileOutputStream( dest ) );				copyStream(input, output);			}			catch(IOException ex)			{				logger.log(Level.SEVERE, ex.getMessage(), ex);			}			finally			{				if( input != null )					input.close();				if( output != null )					output.close();				}		}			}