View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.vfs2;
18  
19  import java.io.IOException;
20  import java.io.OutputStream;
21  
22  import org.apache.commons.vfs2.util.FileObjectUtils;
23  
24  /**
25   * Utility methods for dealing with FileObjects.
26   *
27   * @deprecated Use {@link org.apache.commons.vfs2.util.FileObjectUtils}.
28   */
29  @Deprecated
30  public final class FileUtil {
31  
32      /**
33       * Copies the content from a source file to a destination file.
34       *
35       * @param srcFile The source FileObject.
36       * @param destFile The target FileObject
37       * @throws IOException If an error occurs copying the file.
38       * @see FileContent#write(FileContent)
39       * @see FileContent#write(FileObject)
40       * @deprecated Use {@link org.apache.commons.vfs2.util.FileObjectUtils#writeContent(FileObject, FileObject)}.
41       */
42      @Deprecated
43      public static void copyContent(final FileObject.html#FileObject">FileObject srcFile, final FileObject destFile) throws IOException {
44          FileObjectUtils.writeContent(srcFile, destFile);
45      }
46  
47      /**
48       * Returns the content of a file, as a byte array.
49       *
50       * @param file The file to get the content of.
51       * @return The content as a byte array.
52       * @throws IOException if the file content cannot be accessed.
53       * @deprecated Use {@link org.apache.commons.vfs2.util.FileObjectUtils#getContentAsByteArray(FileObject)}.
54       */
55      @Deprecated
56      public static byte[] getContent(final FileObject file) throws IOException {
57          return FileObjectUtils.getContentAsByteArray(file);
58      }
59  
60      /**
61       * Writes the content of a file to an OutputStream.
62       *
63       * @param file The FileObject to write.
64       * @param output The OutputStream to write to.
65       * @throws IOException if an error occurs writing the file.
66       * @see FileContent#write(OutputStream)
67       * @deprecated Use {@link org.apache.commons.vfs2.util.FileObjectUtils#writeContent(FileObject, OutputStream)}.
68       */
69      @Deprecated
70      public static void writeContent(final FileObject file, final OutputStream output) throws IOException {
71          FileObjectUtils.writeContent(file, output);
72      }
73  
74      /**
75       * No instances.
76       */
77      private FileUtil() {
78          // empty
79      }
80  
81  }