001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.commons.vfs2;
018
019import java.io.IOException;
020import java.io.OutputStream;
021
022import org.apache.commons.vfs2.util.FileObjectUtils;
023
024/**
025 * Utility methods for dealing with FileObjects.
026 *
027 * @deprecated Use {@link org.apache.commons.vfs2.util.FileObjectUtils}.
028 */
029@Deprecated
030public final class FileUtil {
031
032    /**
033     * Copies the content from a source file to a destination file.
034     *
035     * @param srcFile The source FileObject.
036     * @param destFile The target FileObject
037     * @throws IOException If an error occurs copying the file.
038     * @see FileContent#write(FileContent)
039     * @see FileContent#write(FileObject)
040     * @deprecated Use {@link org.apache.commons.vfs2.util.FileObjectUtils#writeContent(FileObject, FileObject)}.
041     */
042    @Deprecated
043    public static void copyContent(final FileObject srcFile, final FileObject destFile) throws IOException {
044        FileObjectUtils.writeContent(srcFile, destFile);
045    }
046
047    /**
048     * Returns the content of a file, as a byte array.
049     *
050     * @param file The file to get the content of.
051     * @return The content as a byte array.
052     * @throws IOException if the file content cannot be accessed.
053     * @deprecated Use {@link org.apache.commons.vfs2.util.FileObjectUtils#getContentAsByteArray(FileObject)}.
054     */
055    @Deprecated
056    public static byte[] getContent(final FileObject file) throws IOException {
057        return FileObjectUtils.getContentAsByteArray(file);
058    }
059
060    /**
061     * Writes the content of a file to an OutputStream.
062     *
063     * @param file The FileObject to write.
064     * @param output The OutputStream to write to.
065     * @throws IOException if an error occurs writing the file.
066     * @see FileContent#write(OutputStream)
067     * @deprecated Use {@link org.apache.commons.vfs2.util.FileObjectUtils#writeContent(FileObject, OutputStream)}.
068     */
069    @Deprecated
070    public static void writeContent(final FileObject file, final OutputStream output) throws IOException {
071        FileObjectUtils.writeContent(file, output);
072    }
073
074    /**
075     * No instances.
076     */
077    private FileUtil() {
078        // empty
079    }
080
081}