List of usage examples for java.io OutputStream write
public void write(byte b[], int off, int len) throws IOException
len
bytes from the specified byte array starting at offset off
to this output stream. From source file:Main.java
public static void writeSCSocketBytes(OutputStream os, byte[] buffer, int len) throws Exception { os.write(buffer, 0, len); os.flush();//from www .j ava 2 s . c o m }
From source file:Main.java
public final static void writeP(final OutputStream out, final ByteBuffer bb) throws IOException { out.write(bb.array(), bb.position(), bb.remaining()); }
From source file:Main.java
static void copy(File src, File dst) throws IOException { InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dst); byte[] buf = new byte[1024]; int len;/*from w ww .j a v a 2s . c om*/ while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } in.close(); out.close(); }
From source file:Main.java
/** * Read input from input stream and write it to output stream * until there is no more input from input stream. * * @param is input stream the input stream to read from. * @param os output stream the output stream to write to. * @param buf the byte array to use as a buffer *///from w ww . java 2s .c o m public static void flow(InputStream is, OutputStream os, byte[] buf) throws IOException { int numRead; while ((numRead = is.read(buf)) >= 0) { os.write(buf, 0, numRead); } }
From source file:Main.java
public static void saveImage(String imageUrl, String destinationFile) throws Exception { URL url = new URL(imageUrl); InputStream is = url.openStream(); OutputStream os = new FileOutputStream(destinationFile); byte[] b = new byte[2048]; int length;//www.jav a 2 s . com while ((length = is.read(b)) != -1) { os.write(b, 0, length); } is.close(); os.close(); }
From source file:Main.java
public static void copy(InputStream in, OutputStream out) throws IOException { byte[] buf = new byte[1024]; int len;//from ww w . j a v a2 s . c o m while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } }
From source file:Main.java
public static void copy(InputStream in, OutputStream out) throws IOException { byte[] buf = new byte[4096]; int bytes;//from w w w . j ava 2 s . c o m while ((bytes = in.read(buf)) != -1) out.write(buf, 0, bytes); }
From source file:Main.java
private static void copy(InputStream in, OutputStream out) throws IOException { byte[] b = new byte[2 * 1024]; int read;//from www . j a va 2 s . co m while ((read = in.read(b)) != -1) { out.write(b, 0, read); } }
From source file:Main.java
private static void copy(InputStream in, OutputStream out) throws IOException { byte[] b = new byte[1 * 1024]; int read;//from w ww . j a v a2 s.co m while ((read = in.read(b)) != -1) { out.write(b, 0, read); } }
From source file:Main.java
private static void copyStream(InputStream is, OutputStream os) throws IOException { byte[] buf = new byte[1024]; int len = 0;/*from w w w.j a v a 2 s. com*/ while ((len = is.read(buf)) != -1) { os.write(buf, 0, len); } }