Get an output stream for writing to a file.

@param aFile
The file to write to. May not be <code>null</code>.
@return <code>null</code> if the file could not be opened
6599
@Nullable
  public static OutputStream getOutputStream (@Nonnull final Path aFile)
  {
    return getOutputStream (aFile, EAppend.DEFAULT);
  }
1162183
public InputStream getInputStream(String strFilename)
    {
        InputStream streamIn = null;
        if ((strFilename != null) && (strFilename.length() > 0))
        {
            try   {
                URL url = null;
                if (strFilename.indexOf(':') == -1)
                    if (this.getApplication() != null)
                        url = this.getApplication().getResourceURL(strFilename, this);
                if (url != null)
                    streamIn = url.openStream();
            } catch (Exception ex)  {
                streamIn = null;
            }
        }
        if (streamIn == null)
            streamIn = Util.getInputStream(strFilename, this.getApplication());
        return streamIn;
    }
157395
public void put(final String aBucket, final String aKey, final AsyncFile aFile,
            final Handler<HttpClientResponse> aHandler) {
        final S3ClientRequest request = createPutRequest(aBucket, aKey, aHandler);
        final Buffer buffer = Buffer.buffer();

        aFile.endHandler(event -> {
            request.putHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(buffer.length()));
            request.end(buffer);
        });

        aFile.handler(data -> {
            buffer.appendBuffer(data);
        });
    }
109924
public OutputStream getOutputStream(String remotefile)
			throws SftpStatusException, SshException {

		String remotePath = resolveRemotePath(remotefile);
		return new SftpFileOutputStream(sftp.openFile(remotePath,
				SftpSubsystemChannel.OPEN_CREATE
						| SftpSubsystemChannel.OPEN_TRUNCATE
						| SftpSubsystemChannel.OPEN_WRITE));

	}
401836
Counter readFromFile() throws IOException {
		if (storageDisabled) {
			return null;
		}
		final File file = getFile();
		if (file.exists()) {
			return readFromFile(file);
		}
		// ou on retourne null si le fichier n'existe pas
		return null;
	}
407975
public InputStream getInputStream(String strFilename)
    {
        InputStream inStream = Utility.getInputStream(strFilename, this.getApplication());
        if (inStream == null)
        	if (this.getParentSession() != null)
        { 
        	Task task = this.getParentSession().getTask();
        	if ((task != null) && (task != this))
        		inStream = task.getInputStream(strFilename);
        }
        return inStream;
    }
490017
public static void waitFor(File aFile)
   
   {
      if(aFile == null)
         return;
      
      String path =aFile.getAbsolutePath();
   
      long previousSize = IO.getFileSize(path);
      long currentSize = previousSize;
      
      long sleepTime = Config.getPropertyLong("file.monitor.file.wait.time",100).longValue();
      
      while(true)
      {
         try
         {
           Thread.sleep(sleepTime);
         }
         catch(InterruptedException e){}
          
          currentSize = IO.getFileSize(path);
       
          if(currentSize == previousSize )
             return;
          
          previousSize = currentSize;
      }
   }
540774
public static OutputStream toFile(File file) throws FileNotFoundException {
		if(file != null) {
			return new FileOutputStream(file);
		}
		return null;
	}
738560
private S getInputStreamForFile(File file) throws IOException {
        assert file != null : "File must be specified";
        return this.getInputStreamForRawStream(new FileInputStream(file));
    }
681330
public static AiffData create(InputStream is) {
		try {
			return create(
				AudioSystem.getAudioInputStream(is));
		} catch (Exception e) {
			org.lwjgl.LWJGLUtil.log("Unable to create from inputstream");
			e.printStackTrace();
			return null;
		}		
	}
259199
public static OutputStream toFile(String filepath) throws FileNotFoundException {
		if(Strings.isValid(filepath)) {
			return new FileOutputStream(new File(filepath));
		}
		return null;
	}
697147
@Nullable
  public static FileOutputStream getOutputStream (@Nonnull final File aFile, @Nonnull final EAppend eAppend)
  {
    ValueEnforcer.notNull (aFile, "File");
    ValueEnforcer.notNull (eAppend, "Append");

    if (internalCheckParentDirectoryExistanceAndAccess (aFile).isInvalid ())
      return null;

    // OK, parent is present and writable
    try
    {
      return new CountingFileOutputStream (aFile, eAppend);
    }
    catch (final FileNotFoundException ex)
    {
      if (LOGGER.isWarnEnabled ())
        LOGGER.warn ("Failed to create output stream for '" +
                     aFile +
                     "'; append: " +
                     eAppend +
                     ": " +
                     ex.getClass ().getName () +
                     " - " +
                     ex.getMessage ());
      return null;
    }
  }
1022334
private String filename(final File aFile) {
		try {
			return aFile.getCanonicalPath();
		} catch (IOException ex) {
			recordException(ex);
			return "UNKNOWN FILE";
		}
	}
860373
public InputStream getInputStream(String pathToFile)
	throws IOException
	{
		File f = new File(pathToFile);
		return getInputStream(f);
	}
445398
public File write(byte[] data, int off, int len, boolean isAppend) throws IORuntimeException {
		FileOutputStream out = null;
		try {
			out = new FileOutputStream(FileUtil.touch(file), isAppend);
			out.write(data, off, len);
			out.flush();
		}catch(IOException e){
			throw new IORuntimeException(e);
		} finally {
			IoUtil.close(out);
		}
		return file;
	}
1241083
private void output(File outFile) throws FileNotFoundException {
    System.out.println("Printing to " + outFile.toString());
    PrintStream out = new PrintStream(outFile);
    root.output(out, null);
    out.close();
  }
1001065
@Override
    public OutputStream getOutputStream() throws IOException {
	if (!_file.isWriteable()) {
	    throw new IOException("Cannot write");
	}
	return IOUtil.toBufferedOutputStream(_file.getOutputStream());
    }