public final class IOUtil extends Object
Modifier and Type | Method and Description |
---|---|
static byte[] |
convertToBytes(org.codehaus.jettison.json.JSONObject jsonObject) |
static byte[] |
decodeBase64(String encoded)
Decode base64 input string, return byte array.
|
static String |
decodeBase64AsString(String encoded)
Decode base64 input string, return content as UTF-8 String.
|
static byte[] |
encodeBase64(byte[] value)
Base64 encode value.
|
static byte[] |
encodeBase64(javax.mail.internet.MimeMessage mimeMessage)
Encodes the content of the provided MimeMessage into a Base64-encoded byte array.
|
static byte[] |
encodeBase64(String value)
Base64 encode value.
|
static String |
encodeBase64AsString(byte[] value)
Base64 encode value.
|
static String |
encodeBase64AsString(String value)
Base64 encode value.
|
static byte[] |
readFully(InputStream inputStream)
Read all inputStream content to a byte array.
|
static BufferedImage |
resizeImage(BufferedImage inputImage,
int max)
Resize image to a max width or height image size.
|
static byte[] |
resizeImage(byte[] inputBytes,
int max)
Resize image bytes to a max width or height image size.
|
static void |
write(InputStream inputStream,
OutputStream outputStream)
Write all inputstream content to outputstream.
|
public static void write(InputStream inputStream, OutputStream outputStream) throws IOException
inputStream
- input streamoutputStream
- output streamIOException
- on errorpublic static byte[] decodeBase64(String encoded)
encoded
- Base64 encoded stringpublic static String decodeBase64AsString(String encoded)
encoded
- Base64 encoded stringpublic static String encodeBase64AsString(String value)
value
- input valuepublic static String encodeBase64AsString(byte[] value)
value
- input valuepublic static byte[] encodeBase64(String value)
value
- input valuepublic static byte[] encodeBase64(byte[] value)
value
- input valuepublic static byte[] encodeBase64(javax.mail.internet.MimeMessage mimeMessage) throws IOException
mimeMessage
- the MimeMessage object whose content is to be encodedIOException
- if an I/O error occurs during encoding or if a MessagingException occurspublic static byte[] resizeImage(byte[] inputBytes, int max) throws IOException
inputBytes
- input image bytesmax
- max sizeIOException
- on errorpublic static BufferedImage resizeImage(BufferedImage inputImage, int max)
inputImage
- input imagemax
- max sizepublic static byte[] readFully(InputStream inputStream) throws IOException
inputStream
- input streamIOException
- on errorpublic static byte[] convertToBytes(org.codehaus.jettison.json.JSONObject jsonObject) throws IOException
IOException
Copyright © 2001–2025 MickaĆ«l Guessant. All rights reserved.