/** * write. * * @param is InputStream instance. * @param os OutputStream instance. * @return count. * @throws IOException */ public static long write(InputStream is, OutputStream os) throws IOException { return write(is, os, BUFFER_SIZE); }
/** * write. * * @param reader Reader. * @param writer Writer. * @return count. * @throws IOException */ public static long write(Reader reader, Writer writer) throws IOException { return write(reader, writer, BUFFER_SIZE); }
/** * write. * * @param reader Reader. * @param writer Writer. * @return count. * @throws IOException */ public static long write(Reader reader, Writer writer) throws IOException { return write(reader, writer, BUFFER_SIZE); }
/** * write. * * @param is InputStream instance. * @param os OutputStream instance. * @return count. * @throws IOException */ public static long write(InputStream is, OutputStream os) throws IOException { return write(is, os, BUFFER_SIZE); }
/** * write string. * * @param writer Writer instance. * @param string String. * @throws IOException */ public static long write(Writer writer, String string) throws IOException { Reader reader = new StringReader(string); try { return write(reader, writer); } finally { reader.close(); } }
/** * write string. * * @param writer Writer instance. * @param string String. * @throws IOException */ public static long write(Writer writer, String string) throws IOException { Reader reader = new StringReader(string); try { return write(reader, writer); } finally { reader.close(); } }
/** * read string. * * @param reader Reader instance. * @return String. * @throws IOException */ public static String read(Reader reader) throws IOException { StringWriter writer = new StringWriter(); try { write(reader, writer); return writer.getBuffer().toString(); } finally { writer.close(); } }
/** * read string. * * @param reader Reader instance. * @return String. * @throws IOException */ public static String read(Reader reader) throws IOException { StringWriter writer = new StringWriter(); try { write(reader, writer); return writer.getBuffer().toString(); } finally { writer.close(); } }
/** * unzip. * * @param bytes compressed byte array. * @return byte uncompressed array. * @throws IOException */ public static byte[] unzip(byte[] bytes) throws IOException { UnsafeByteArrayInputStream bis = new UnsafeByteArrayInputStream(bytes); UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(); InputStream is = new InflaterInputStream(bis); try { IOUtils.write(is, bos); return bos.toByteArray(); } finally { is.close(); bis.close(); bos.close(); } }
/** * unzip. * * @param bytes compressed byte array. * @return byte uncompressed array. * @throws IOException */ public static byte[] unzip(byte[] bytes) throws IOException { UnsafeByteArrayInputStream bis = new UnsafeByteArrayInputStream(bytes); UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(); InputStream is = new InflaterInputStream(bis); try { IOUtils.write(is, bos); return bos.toByteArray(); } finally { is.close(); bis.close(); bos.close(); } }
/** * write. * * @param is InputStream instance. * @param os OutputStream instance. * @return count. * @throws IOException */ public static long write(InputStream is, OutputStream os) throws IOException { return write(is, os, BUFFER_SIZE); }
/** * write. * * @param reader Reader. * @param writer Writer. * @return count. * @throws IOException */ public static long write(Reader reader, Writer writer) throws IOException { return write(reader, writer, BUFFER_SIZE); }
/** * write. * * @param is InputStream instance. * @param os OutputStream instance. * @return count. * @throws IOException */ public static long write(InputStream is, OutputStream os) throws IOException { return write(is, os, BUFFER_SIZE); }
/** * write. * * @param reader Reader. * @param writer Writer. * @return count. * @throws IOException */ public static long write(Reader reader, Writer writer) throws IOException { return write(reader, writer, BUFFER_SIZE); }
/** * write string. * * @param writer Writer instance. * @param string String. * @throws IOException */ public static long write(Writer writer, String string) throws IOException { Reader reader = new StringReader(string); try { return write(reader, writer); } finally { reader.close(); } }
/** * write string. * * @param writer Writer instance. * @param string String. * @throws IOException */ public static long write(Writer writer, String string) throws IOException { Reader reader = new StringReader(string); try { return write(reader, writer); } finally { reader.close(); } }
/** * read string. * * @param reader Reader instance. * @return String. * @throws IOException */ public static String read(Reader reader) throws IOException { StringWriter writer = new StringWriter(); try { write(reader, writer); return writer.getBuffer().toString(); } finally { writer.close(); } }
/** * read string. * * @param reader Reader instance. * @return String. * @throws IOException */ public static String read(Reader reader) throws IOException { StringWriter writer = new StringWriter(); try { write(reader, writer); return writer.getBuffer().toString(); } finally { writer.close(); } }
/** * unzip. * * @param bytes compressed byte array. * @return byte uncompressed array. * @throws IOException */ public static byte[] unzip(byte[] bytes) throws IOException { UnsafeByteArrayInputStream bis = new UnsafeByteArrayInputStream(bytes); UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(); InputStream is = new InflaterInputStream(bis); try { IOUtils.write(is, bos); return bos.toByteArray(); } finally { is.close(); bis.close(); bos.close(); } }
/** * unzip. * * @param bytes compressed byte array. * @return byte uncompressed array. * @throws IOException */ public static byte[] unzip(byte[] bytes) throws IOException { UnsafeByteArrayInputStream bis = new UnsafeByteArrayInputStream(bytes); UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(); InputStream is = new InflaterInputStream(bis); try { IOUtils.write(is, bos); return bos.toByteArray(); } finally { is.close(); bis.close(); bos.close(); } }