|
eXo Kernel :: Commons Utils 2.4.13-GA | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.exoplatform.commons.utils.IOUtil
public class IOUtil
| Constructor Summary | |
|---|---|
IOUtil()
|
|
| Method Summary | |
|---|---|
static Object |
deserialize(byte[] bytes)
Deprecated. |
static String |
getFileContenntAsString(File file)
Deprecated. |
static String |
getFileContenntAsString(File file,
String encoding)
Deprecated. |
static String |
getFileContenntAsString(String fileName)
Deprecated. |
static String |
getFileContenntAsString(String fileName,
String encoding)
Deprecated. |
static byte[] |
getFileContentAsBytes(String fileName)
Returns the content of the file specified by its name as a byte array. |
static String |
getFileContentAsString(File file)
Returns the content of the specified file as a string using the UTF-8 charset. |
static String |
getFileContentAsString(File file,
String charset)
Returns the content of the specified file as a string using the specified charset. |
static String |
getFileContentAsString(String fileName)
Returns the content of the specified file as a string using the UTF-8 |
static String |
getFileContentAsString(String fileName,
String charset)
Returns the content of the specified file as a string using the specified charset. |
static byte[] |
getResourceAsBytes(String resource)
Get a resource from the thread context classloader and returns its content as a byte array. |
static String |
getResourceAsString(String resource)
Get a resource from the thread context classloader and returns its content as a string. |
static byte[] |
getStreamContentAsBytes(InputStream is)
Reads a stream until its end and returns its content as a byte array. |
static String |
getStreamContentAsString(InputStream is)
Returns the content of the specified stream as a string using the UTF-8 charset. |
static byte[] |
serialize(Object obj)
Deprecated. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IOUtil()
| Method Detail |
|---|
public static String getFileContentAsString(File file)
throws IOException,
IllegalArgumentException
UTF-8 charset.
file - the file
IOException - any io exception
IllegalArgumentException - if any argument is null
public static String getFileContentAsString(File file,
String charset)
throws IOException,
IllegalArgumentException
file - the filecharset - the charset
IOException - any io exception
IllegalArgumentException - if any argument is null
public static String getFileContentAsString(String fileName,
String charset)
throws IOException,
IllegalArgumentException
fileName - the file namecharset - the charset
IOException - any io exception
IllegalArgumentException - if any argument is null
public static String getFileContentAsString(String fileName)
throws IOException,
IllegalArgumentException
UTF-8 charset.
- Parameters:
fileName - the file name
- Returns:
- the content
- Throws:
IOException - any io exception
IllegalArgumentException - if any argument is null
public static String getStreamContentAsString(InputStream is)
throws IOException,
IllegalArgumentException
UTF-8 charset.
is - the stream
IOException - any io exception
IllegalArgumentException - if the specified stream is null
public static byte[] getFileContentAsBytes(String fileName)
throws IOException,
IllegalArgumentException
fileName - the file name
IOException - any io exception
IllegalArgumentException - if the specified file name is null
public static byte[] getStreamContentAsBytes(InputStream is)
throws IOException,
IllegalArgumentException
is - the input stream
IOException - if any IOException occurs during a read
IllegalArgumentException - if the provided input stream is null
public static String getResourceAsString(String resource)
throws IOException
ClassLoader.getResource(String) on the context classloader
associated with the current thread of execution. The charset used for encoding the resource as a string is
UTF-8.
resource - the resource name
IllegalArgumentException - if the specified argument is null or the loaded resource does not exist
IOException - thrown by accessing the resource
public static byte[] getResourceAsBytes(String resource)
throws IOException
ClassLoader.getResource(String) on the context classloader
associated with the current thread of execution.
resource - the resource name
IllegalArgumentException - if the specified argument is null or the loaded resource does not exist
IOException - thrown by accessing the resource
@Deprecated
public static byte[] serialize(Object obj)
throws Exception
Exception
@Deprecated
public static Object deserialize(byte[] bytes)
throws Exception
Exception
@Deprecated
public static String getFileContenntAsString(File file)
throws Exception
getFileContentAsString(File) instead.
Exception
@Deprecated
public static String getFileContenntAsString(File file,
String encoding)
throws Exception
getFileContentAsString(File,String) instead.
Exception
@Deprecated
public static String getFileContenntAsString(String fileName,
String encoding)
throws Exception
getFileContentAsString(String,String) instead.
Exception
@Deprecated
public static String getFileContenntAsString(String fileName)
throws Exception
getFileContentAsString(String) instead.
Exception
|
eXo Kernel :: Commons Utils 2.4.13-GA | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||