|
||||||||||
| 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 java.lang.Object |
deserialize(byte[] bytes)
Deprecated. |
static java.lang.String |
getFileContenntAsString(java.io.File file)
Deprecated. |
static java.lang.String |
getFileContenntAsString(java.io.File file,
java.lang.String encoding)
Deprecated. |
static java.lang.String |
getFileContenntAsString(java.lang.String fileName)
Deprecated. |
static java.lang.String |
getFileContenntAsString(java.lang.String fileName,
java.lang.String encoding)
Deprecated. |
static byte[] |
getFileContentAsBytes(java.lang.String fileName)
Returns the content of the file specified by its name as a byte array. |
static java.lang.String |
getFileContentAsString(java.io.File file)
Returns the content of the specified file as a string using the UTF-8 charset. |
static java.lang.String |
getFileContentAsString(java.io.File file,
java.lang.String charset)
Returns the content of the specified file as a string using the specified charset. |
static java.lang.String |
getFileContentAsString(java.lang.String fileName)
Returns the content of the specified file as a string using the UTF-8 |
static java.lang.String |
getFileContentAsString(java.lang.String fileName,
java.lang.String charset)
Returns the content of the specified file as a string using the specified charset. |
static byte[] |
getResourceAsBytes(java.lang.String resource)
Get a resource from the thread context classloader and returns its content as a byte array. |
static java.lang.String |
getResourceAsString(java.lang.String resource)
Get a resource from the thread context classloader and returns its content as a string. |
static byte[] |
getStreamContentAsBytes(java.io.InputStream is)
Reads a stream until its end and returns its content as a byte array. |
static java.lang.String |
getStreamContentAsString(java.io.InputStream is)
Returns the content of the specified stream as a string using the UTF-8 charset. |
static byte[] |
serialize(java.lang.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 java.lang.String getFileContentAsString(java.io.File file)
throws java.io.IOException,
java.lang.NullPointerException
UTF-8 charset.
file - the file
java.io.IOException - any io exception
java.lang.NullPointerException - if any argument is null
public static java.lang.String getFileContentAsString(java.io.File file,
java.lang.String charset)
throws java.io.IOException,
java.lang.NullPointerException
file - the filecharset - the charset
java.io.IOException - any io exception
java.lang.NullPointerException - if any argument is null
public static java.lang.String getFileContentAsString(java.lang.String fileName,
java.lang.String charset)
throws java.io.IOException,
java.lang.NullPointerException
fileName - the file namecharset - the charset
java.io.IOException - any io exception
java.lang.NullPointerException - if any argument is null
public static java.lang.String getFileContentAsString(java.lang.String fileName)
throws java.io.IOException,
java.lang.NullPointerException
UTF-8 charset.
- Parameters:
fileName - the file name
- Returns:
- the content
- Throws:
java.io.IOException - any io exception
java.lang.NullPointerException - if any argument is null
public static java.lang.String getStreamContentAsString(java.io.InputStream is)
throws java.io.IOException,
java.lang.NullPointerException
UTF-8 charset.
is - the stream
java.io.IOException - any io exception
java.lang.NullPointerException - if the specified stream is null
public static byte[] getFileContentAsBytes(java.lang.String fileName)
throws java.io.IOException,
java.lang.NullPointerException
fileName - the file name
java.io.IOException - any io exception
java.lang.NullPointerException - if the specified file name is null
public static byte[] getStreamContentAsBytes(java.io.InputStream is)
throws java.io.IOException,
java.lang.NullPointerException
is - the input stream
java.io.IOException - if any IOException occurs during a read
java.lang.NullPointerException - if the provided input stream is null
public static java.lang.String getResourceAsString(java.lang.String resource)
throws java.io.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
java.lang.NullPointerException - if the specified argument is null or the loaded resource does not exist
java.io.IOException - thrown by accessing the resource
public static byte[] getResourceAsBytes(java.lang.String resource)
throws java.io.IOException
ClassLoader.getResource(String) on the context classloader
associated with the current thread of execution.
resource - the resource name
java.lang.NullPointerException - if the specified argument is null or the loaded resource does not exist
java.io.IOException - thrown by accessing the resource
@Deprecated
public static byte[] serialize(java.lang.Object obj)
throws java.lang.Exception
java.lang.Exception
@Deprecated
public static java.lang.Object deserialize(byte[] bytes)
throws java.lang.Exception
java.lang.Exception
@Deprecated
public static java.lang.String getFileContenntAsString(java.io.File file)
throws java.lang.Exception
getFileContentAsString(File) instead.
java.lang.Exception
@Deprecated
public static java.lang.String getFileContenntAsString(java.io.File file,
java.lang.String encoding)
throws java.lang.Exception
getFileContentAsString(File,String) instead.
java.lang.Exception
@Deprecated
public static java.lang.String getFileContenntAsString(java.lang.String fileName,
java.lang.String encoding)
throws java.lang.Exception
getFileContentAsString(String,String) instead.
java.lang.Exception
@Deprecated
public static java.lang.String getFileContenntAsString(java.lang.String fileName)
throws java.lang.Exception
getFileContentAsString(String) instead.
java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||