public class FileUtil
extends java.lang.Object
Constructor and Description |
---|
FileUtil() |
Modifier and Type | Method and Description |
---|---|
static java.io.File |
addExtensionIfNone(java.io.File file,
java.lang.String extension) |
static void |
close(java.io.Closeable is) |
static java.util.List |
getContents(java.io.InputStream inputStream) |
static java.util.List |
getContents(java.lang.String filename) |
static java.util.List |
getContents(java.net.URI uri) |
static java.lang.String |
getExtension(java.io.File f) |
static java.lang.String |
getExtension(java.lang.String s) |
static java.lang.String |
getFileNameFromLayerName(java.lang.String layerName) |
static java.io.File |
removeExtensionIfAny(java.io.File file) |
static void |
setContents(java.lang.String textFileName,
java.util.List lines)
Saves the List of Strings to a file with the given filename.
|
static void |
setContents(java.lang.String textFileName,
java.lang.String contents)
Saves the String to a file with the given filename.
|
static void |
zip(java.util.Collection files,
java.io.File zipFile) |
public static java.util.List getContents(java.lang.String filename) throws java.io.IOException
java.io.IOException
public static java.util.List getContents(java.net.URI uri) throws java.io.IOException
java.io.IOException
public static void setContents(java.lang.String textFileName, java.lang.String contents) throws java.io.IOException
textFileName
- the pathname of the file to create (or overwrite)contents
- the data to savejava.io.IOException
- if an I/O error occurs.public static java.util.List getContents(java.io.InputStream inputStream) throws java.io.IOException
java.io.IOException
public static void setContents(java.lang.String textFileName, java.util.List lines) throws java.io.IOException
textFileName
- the pathname of the file to create (or overwrite)lines
- the Strings to save as lines in the filejava.io.IOException
- if an I/O error occurs.public static void zip(java.util.Collection files, java.io.File zipFile) throws java.io.IOException
java.io.IOException
public static java.lang.String getExtension(java.lang.String s)
public static java.lang.String getExtension(java.io.File f)
public static java.io.File addExtensionIfNone(java.io.File file, java.lang.String extension)
public static java.io.File removeExtensionIfAny(java.io.File file)
public static java.lang.String getFileNameFromLayerName(java.lang.String layerName)
public static void close(java.io.Closeable is)