Package com.logicaldoc.util.io
Class IOUtil
java.lang.Object
com.logicaldoc.util.io.IOUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Close the given resource.static Object
deserialize
(String xml) Deserializes an XML serialization to obtain the objectstatic byte[]
getBytesOfStream
(InputStream stream) static InputStream
getLimitedStream
(InputStream input, long limit) Creates a new input stream that represents the first part of the original stream.static String
static String
serialize
(Serializable object, String charset) Serializes an object into XML stringstatic void
write
(InputStream input, File output) static void
write
(InputStream input, OutputStream output)
-
Method Details
-
close
Close the given resource.- Parameters:
resource
- The resource to be closed.
-
getLimitedStream
Creates a new input stream that represents the first part of the original stream.- Parameters:
input
- Original input streamlimit
- Size of the new stream, expressed in bytes- Returns:
- the limited input stream
-
write
- Throws:
IOException
-
write
- Throws:
IOException
-
readStream
- Throws:
IOException
-
getBytesOfStream
- Throws:
IOException
-
serialize
Serializes an object into XML string- Parameters:
object
- The object to serializecharset
- The charset to use for the output, if not provided UTF-8 is used instead- Returns:
- The serialized string
-
deserialize
Deserializes an XML serialization to obtain the object- Parameters:
xml
- The XML content- Returns:
- The recovered object
-