org.abstracthorizon.danube.http.util
Class IOUtils
java.lang.Object
org.abstracthorizon.danube.http.util.IOUtils
public class IOUtils
- extends Object
IO util methods
- Author:
- Daniel Sendula
Method Summary |
static String |
addPaths(String path1,
String path2)
Adds two paths together always ensuring that it starts with a "/" and if path 2 is "/" to end with "/" |
static String |
compareArrays(byte[] buf1,
byte[] buf2,
long previousSize,
int size)
|
static String |
compareStreams(InputStream s1,
InputStream s2)
|
static String |
compareStreams(InputStream s1,
InputStream s2,
long size)
|
static boolean |
copy(File from,
File to,
boolean recursive)
|
static boolean |
copyFile(File from,
File to)
|
static void |
copyStreams(InputStream inputStream,
OutputStream outputStream)
|
static File |
createRandomFile(File path,
String name,
int size)
|
static boolean |
delete(File dir)
|
static String |
lastPathComponent(String path)
|
static String |
parentPath(String path)
|
static void |
transferToFileChannel(FileChannel fileChannel,
ReadableByteChannel inputChannel,
long length)
Transfer given channel to the file channel |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IOUtils
public IOUtils()
transferToFileChannel
public static void transferToFileChannel(FileChannel fileChannel,
ReadableByteChannel inputChannel,
long length)
throws IOException
- Transfer given channel to the file channel
- Parameters:
inputChannel
- file channelfileChannel
- output channellength
- length
- Throws:
IOException
- IO exception
addPaths
public static String addPaths(String path1,
String path2)
- Adds two paths together always ensuring that it starts with a "/" and if path 2 is "/" to end with "/"
- Parameters:
path1
- path onepath2
- path two
- Returns:
- new path
lastPathComponent
public static String lastPathComponent(String path)
parentPath
public static String parentPath(String path)
compareStreams
public static String compareStreams(InputStream s1,
InputStream s2)
throws IOException
- Throws:
IOException
compareStreams
public static String compareStreams(InputStream s1,
InputStream s2,
long size)
throws IOException
- Throws:
IOException
compareArrays
public static String compareArrays(byte[] buf1,
byte[] buf2,
long previousSize,
int size)
delete
public static boolean delete(File dir)
copy
public static boolean copy(File from,
File to,
boolean recursive)
copyFile
public static boolean copyFile(File from,
File to)
createRandomFile
public static File createRandomFile(File path,
String name,
int size)
throws IOException
- Throws:
IOException
copyStreams
public static void copyStreams(InputStream inputStream,
OutputStream outputStream)
throws IOException
- Throws:
IOException
Copyright © 2005-2009 Abstract Horizon. All Rights Reserved.