com.dyuproject.util
Class ResourceUtil

java.lang.Object
  extended by com.dyuproject.util.ResourceUtil

public abstract class ResourceUtil
extends Object

Util for files and streams.

Author:
David Yu

Field Summary
static int BUFFER_SIZE
           
 
Constructor Summary
ResourceUtil()
           
 
Method Summary
static void copy(File in, File out)
           
static void copy(InputStream in, OutputStream out)
           
static void copy(URL in, File out)
           
static void copy(URL in, URL out)
           
static void copyFileToDir(File file, File dirTo)
           
static File getBaseDir()
           
static ByteArrayOutputStream getByteArrayOutputStream(InputStream in)
           
static String getCurrentPath()
           
static List<File> getFilesByExtension(File dir, String[] extensions)
           
static byte[] readBytes(File file)
           
static byte[] readBytes(InputStream in)
           
static byte[] readBytes(String file)
           
static byte[] readBytes(URI file)
           
static byte[] readBytes(URL file)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFER_SIZE

public static final int BUFFER_SIZE
See Also:
Constant Field Values
Constructor Detail

ResourceUtil

public ResourceUtil()
Method Detail

getCurrentPath

public static String getCurrentPath()

getBaseDir

public static File getBaseDir()

readBytes

public static byte[] readBytes(File file)
                        throws IOException
Throws:
IOException

readBytes

public static byte[] readBytes(String file)
                        throws IOException
Throws:
IOException

readBytes

public static byte[] readBytes(URI file)
                        throws IOException
Throws:
IOException

readBytes

public static byte[] readBytes(URL file)
                        throws IOException
Throws:
IOException

readBytes

public static byte[] readBytes(InputStream in)
                        throws IOException
Throws:
IOException

getByteArrayOutputStream

public static ByteArrayOutputStream getByteArrayOutputStream(InputStream in)
                                                      throws IOException
Throws:
IOException

copy

public static void copy(URL in,
                        URL out)
                 throws IOException
Throws:
IOException

copy

public static void copy(File in,
                        File out)
                 throws IOException
Throws:
IOException

copy

public static void copy(URL in,
                        File out)
                 throws IOException
Throws:
IOException

copy

public static void copy(InputStream in,
                        OutputStream out)
                 throws IOException
Throws:
IOException

copyFileToDir

public static void copyFileToDir(File file,
                                 File dirTo)
                          throws IOException
Throws:
IOException

getFilesByExtension

public static List<File> getFilesByExtension(File dir,
                                             String[] extensions)


Copyright © 2013. All Rights Reserved.