public void write( OutputStream output ) throws IOException { IOUtils.write( imageByteArray, output ); }
public InputStream getInputStream() throws IOException { ByteArrayOutputStream o = new ByteArrayOutputStream(); IOUtils.write( super.toByteArray(), o ); return new ByteArrayInputStream( o.toByteArray() ); } }
public InputStream getInputStream() throws IOException { ByteArrayOutputStream o = new ByteArrayOutputStream(); IOUtils.write( super.toByteArray(), o ); return new ByteArrayInputStream( o.toByteArray() ); } }
public InputStream getInputStream() throws IOException { ByteArrayOutputStream o = new ByteArrayOutputStream(); IOUtils.write(super.toCharArray(), o, charset.name()); return new ByteArrayInputStream(o.toByteArray()); } }
public InputStream getInputStream() throws IOException { ByteArrayOutputStream o = new ByteArrayOutputStream(); IOUtils.write( super.toCharArray(), o, charset.name() ); return new ByteArrayInputStream( o.toByteArray() ); } }
/** * Writes bytes from a <code>byte[]</code> to chars on a <code>Writer</code> using the specified character encoding. * <p> * Character encoding names can be found at <a href="http://www.iana.org/assignments/character-sets">IANA</a>. * <p> * This method uses {@link String#String(byte[], String)}. * * @param data the byte array to write, do not modify during output, null ignored * @param output the <code>Writer</code> to write to * @param encoding the encoding to use, null means platform default * @throws NullPointerException if output is null * @throws IOException if an I/O error occurs * @since Commons IO 1.1 */ public static void write( byte[] data, Writer output, String encoding ) throws IOException { if ( data != null ) { if ( encoding == null ) { write( data, output ); } else { output.write( new String( data, encoding ) ); } } }
/** * Writes chars from a <code>String</code> to bytes on an <code>OutputStream</code> using the specified character * encoding. * <p> * Character encoding names can be found at <a href="http://www.iana.org/assignments/character-sets">IANA</a>. * <p> * This method uses {@link String#getBytes(String)}. * * @param data the <code>String</code> to write, null ignored * @param output the <code>OutputStream</code> to write to * @param encoding the encoding to use, null means platform default * @throws NullPointerException if output is null * @throws IOException if an I/O error occurs * @since Commons IO 1.1 */ public static void write( String data, OutputStream output, String encoding ) throws IOException { if ( data != null ) { if ( encoding == null ) { write( data, output ); } else { output.write( data.getBytes( encoding ) ); } } }
if (data != null) { if (encoding == null) { write(data, output); } else { output.write(data.getBytes(encoding));
/** * Writes chars from a <code>char[]</code> to bytes on an <code>OutputStream</code> using the specified character * encoding. * <p> * Character encoding names can be found at <a href="http://www.iana.org/assignments/character-sets">IANA</a>. * <p> * This method uses {@link String#String(char[])} and {@link String#getBytes(String)}. * * @param data the char array to write, do not modify during output, null ignored * @param output the <code>OutputStream</code> to write to * @param encoding the encoding to use, null means platform default * @throws NullPointerException if output is null * @throws IOException if an I/O error occurs * @since Commons IO 1.1 */ public static void write( char[] data, OutputStream output, String encoding ) throws IOException { if ( data != null ) { if ( encoding == null ) { write( data, output ); } else { output.write( new String( data ).getBytes( encoding ) ); } } }
if (data != null) { if (encoding == null) { write(data, output); } else { output.write(new String(data, encoding));
if (data != null) { if (encoding == null) { write(data, output); } else { output.write(new String(data).getBytes(encoding));
if (data != null) { if (encoding == null) { write(data, output); } else { output.write(data.toString().getBytes(encoding));
/** * Writes chars from a <code>StringBuffer</code> to bytes on an <code>OutputStream</code> using the specified * character encoding. * <p> * Character encoding names can be found at <a href="http://www.iana.org/assignments/character-sets">IANA</a>. * <p> * This method uses {@link String#getBytes(String)}. * * @param data the <code>StringBuffer</code> to write, null ignored * @param output the <code>OutputStream</code> to write to * @param encoding the encoding to use, null means platform default * @throws NullPointerException if output is null * @throws IOException if an I/O error occurs * @since Commons IO 1.1 */ public static void write( StringBuffer data, OutputStream output, String encoding ) throws IOException { if ( data != null ) { if ( encoding == null ) { write( data, output ); } else { output.write( data.toString().getBytes( encoding ) ); } } }
public static void generateJSONZipEntry( IXDocReport report, IContext context, boolean upperCaseFirstChar, IContext dumpContext, ZipOutputStream out, String src ) throws IOException { String jsonFileName = getJSONFileName( report, dumpContext ); JSONObject jsonObject = new JSONObject( context.getContextMap(), upperCaseFirstChar ); ZipEntry zipEntry = new ZipEntry( src + "/" + jsonFileName ); out.putNextEntry( zipEntry ); Writer jsonWriter = null; try { jsonWriter = new OutputStreamWriter( out ); String json = jsonObject.toString( 1 ); IOUtils.write( json, jsonWriter ); } finally { if ( jsonWriter != null ) { jsonWriter.flush(); } out.closeEntry(); } }
public static void generateJSONFile( IXDocReport report, IContext context, boolean upperCaseFirstChar, IContext dumpContext, File srcDir ) throws IOException { String jsonFileName = getJSONFileName( report, dumpContext ); JSONObject jsonObject = new JSONObject( context.getContextMap(), upperCaseFirstChar ); File jsonFile = new File( srcDir, jsonFileName ); jsonFile.getParentFile().mkdirs(); Writer jsonWriter = null; try { jsonWriter = new FileWriter( jsonFile ); String json = jsonObject.toString( 1 ); IOUtils.write( json, jsonWriter ); } finally { if ( jsonWriter != null ) { IOUtils.closeQuietly( jsonWriter ); } } }
public void upload( BinaryData data ) throws ResourcesException { String resourceId = data.getResourceId(); byte[] input = data.getContent(); String resourcePath = getResourcePath( resourceId ); File file = new File( getRootFolder(), resourcePath ); if ( !file.getParentFile().exists() ) { file.getParentFile().mkdirs(); } OutputStream output = null; try { output = new FileOutputStream( file ); IOUtils.write( input, output ); } catch ( IOException e ) { throw new ResourcesException( e ); } finally { if ( output != null ) { IOUtils.closeQuietly( output ); } } }
zipEntry.setCompressedSize( inputBytes.length ); zipOutputStream.putNextEntry( zipEntry ); IOUtils.write( inputBytes, zipOutputStream );
zipEntry.setCompressedSize(inputBytes.length); zipOutputStream.putNextEntry(zipEntry); IOUtils.write(inputBytes, zipOutputStream); } else { zipOutputStream.putNextEntry(zipEntry);