Java FileOutputStream Create getOutputStreamForFile(final File file)

Here you can find the source of getOutputStreamForFile(final File file)

Description

Reads a file an returns an OutputStream from it.

License

Open Source License

Parameter

Parameter Description
file <code>File</code> from which the <code>OutputStream</code> is created.

Exception

Parameter Description
IOException an exception

Return

the OutputStream.

Declaration

public static OutputStream getOutputStreamForFile(final File file) throws FileNotFoundException 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2010-2014 Alexander Kerner. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License./* ww w .  j  av  a  2  s .c o  m*/
 ******************************************************************************/

import java.io.File;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import java.io.OutputStream;

public class Main {
    /**
     * Reads a file an returns an <code>OutputStream</code> from it.
     *
     * @param file
     *            <code>File</code> from which the <code>OutputStream</code> is
     *            created.
     * @return the <code>OutputStream</code>.
     * @throws IOException
     */
    public static OutputStream getOutputStreamForFile(final File file) throws FileNotFoundException {
        return new FileOutputStream(file);
    }
}

Related

  1. getOutputStream(String fname, String enc, boolean append)
  2. getOutputStream(String path)
  3. getOutputStream(String path)
  4. getOutputStream(String root, String name, boolean overwrite, boolean verbose)
  5. getOutputStream(String theFilePath)
  6. getOutputStreamForFile(String filename)
  7. writeFile(File outFile, ZipInputStream zipInputStream, ZipEntry entry)
  8. writeFile(FileOutputStream fileoutputstream, byte abyte0[], int i)
  9. writeFile(final String filename, final byte[] data)