Code example for PrintStream

Methods: write

0
				new Thread(new Runnable() {
					 
					@Override 
					public void run() { 
						try { 
							ps.write(arr);
						} catch (IOException e) {
							e.printStackTrace();
						} 
					} 
				}).start();
				ps.flush();
				int progress = 0;
				while(progress < arr.length){
//					progress = Integer.valueOf(br.readLine()); 
					String progressS = br.readLine();
					if(progressS == null) break;
					progress = Integer.valueOf(progressS);
					sendBroadcast(new Intent().setAction("progress").putExtra("progress", progress));
				} 
				sendBroadcast(new Intent().setAction("progress").putExtra("progress", arr.length));