|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.io.IOUtils
hudson.util.IOUtils
public class IOUtils
Adds more to commons-io.
Field Summary |
---|
Fields inherited from class org.apache.commons.io.IOUtils |
---|
DIR_SEPARATOR, DIR_SEPARATOR_UNIX, DIR_SEPARATOR_WINDOWS, LINE_SEPARATOR, LINE_SEPARATOR_UNIX, LINE_SEPARATOR_WINDOWS |
Constructor Summary | |
---|---|
IOUtils()
|
Method Summary | |
---|---|
static File |
absolutize(File base,
String path)
Resolves the given path with respect to given base. |
static void |
copy(File src,
OutputStream out)
|
static void |
copy(InputStream in,
File out)
|
static void |
drain(InputStream in)
Drains the input stream and closes it. |
static boolean |
isAbsolute(String path)
See FilePath.isAbsolute(String) . |
static File |
mkdirs(File dir)
Ensures that the given directory exists (if not, it's created, including all the parent directories.) |
static int |
mode(File f)
Gets the mode of a file/directory, if appropriate. |
static String |
readFirstLine(InputStream is,
String encoding)
Read the first line of the given stream, close it, and return that line. |
static InputStream |
skip(InputStream in,
long size)
Fully skips the specified size from the given input stream. |
Methods inherited from class org.apache.commons.io.IOUtils |
---|
closeQuietly, closeQuietly, closeQuietly, closeQuietly, contentEquals, contentEquals, copy, copy, copy, copy, copy, copy, copyLarge, copyLarge, lineIterator, lineIterator, readLines, readLines, readLines, toByteArray, toByteArray, toByteArray, toByteArray, toCharArray, toCharArray, toCharArray, toInputStream, toInputStream, toString, toString, toString, toString, toString, write, write, write, write, write, write, write, write, write, write, write, write, writeLines, writeLines, writeLines |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IOUtils()
Method Detail |
---|
public static void drain(InputStream in) throws IOException
IOException
public static void copy(File src, OutputStream out) throws IOException
IOException
public static void copy(InputStream in, File out) throws IOException
IOException
public static File mkdirs(File dir) throws IOException
IOException
public static InputStream skip(InputStream in, long size) throws IOException
InputStream.skip(long)
has two problems. One is that
it doesn't let us reliably differentiate "hit EOF" case vs "inpustream just returning 0 since there's no data
currently available at hand", and some subtypes (such as FileInputStream.skip(long)
returning -1.
So to reliably skip just the N bytes, we'll actually read all those bytes.
IOException
public static File absolutize(File base, String path)
It would be nice if File#File(File, String) were doing this.
base
- File that represents the parent, may be null if path is absolutepath
- Path of the file, may not be null
FilePath.absolutize()
public static boolean isAbsolute(String path)
FilePath.isAbsolute(String)
.
path
- String representing Platform Specific
(unlike FilePath, which may get Platform agnostic paths), may not be null
public static int mode(File f) throws PosixException
PosixException
- if the file could not be statted, e.g. broken symlinkpublic static String readFirstLine(InputStream is, String encoding) throws IOException
encoding
- If null, use the platform default encoding.
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |