Package com.oracle.bmc.util.internal
Enum FileUtils
- java.lang.Object
-
- java.lang.Enum<FileUtils>
-
- com.oracle.bmc.util.internal.FileUtils
-
- All Implemented Interfaces:
Serializable
,Comparable<FileUtils>
public enum FileUtils extends Enum<FileUtils>
Utilities for interacting with files.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
contentEquals(File f1, File f2)
Return true if the content of both files is the same.static boolean
contentEquals(InputStream is1, InputStream is2)
Return true if the content of both streams is the same.static long
copy(InputStream source, OutputStream destination)
Copy the contents of the input stream to the output stream.static String
expandUserHome(String path)
Attempts to expand paths that may contain unix-style home shorthand.static FileUtils
valueOf(String name)
Returns the enum constant of this type with the specified name.static FileUtils[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Method Detail
-
values
public static FileUtils[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (FileUtils c : FileUtils.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static FileUtils valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
expandUserHome
public static String expandUserHome(String path)
Attempts to expand paths that may contain unix-style home shorthand.- Parameters:
path
- The path- Returns:
- The path after expanding the home directory, if needed.
-
contentEquals
public static boolean contentEquals(File f1, File f2) throws IOException
Return true if the content of both files is the same.- Parameters:
f1
- first filef2
- second file- Returns:
- true if the same
- Throws:
IOException
-
contentEquals
public static boolean contentEquals(InputStream is1, InputStream is2) throws IOException
Return true if the content of both streams is the same.- Parameters:
is1
- first streamis2
- second stream- Returns:
- true if the same
- Throws:
IOException
-
copy
public static long copy(InputStream source, OutputStream destination) throws IOException
Copy the contents of the input stream to the output stream.- Parameters:
source
- input streamdestination
- output stream- Returns:
- number of bytes read
- Throws:
IOException
-
-