Code example for BufferedOutputStream

Methods: write, close

0
		} else {			 
			response.setContentType("application/vnd.android.package-archive");
			response.addHeader("content-disposition",
					"attachment; filename=" + makeFilename(program)
			); 
			BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
			out.write(pkg.getContent().getBytes());
			out.close();
		} 
	} 
	 
	private String makeFilename(Program program) {
		String title = program.getTitle();
		String[] chunks = title.split("[^\\w\\d]+");
		StringBuilder builder = new StringBuilder();
		for(int i = 0; i < chunks.length; i++) {
			if (chunks[i].length() > 0) {
				builder.append(Character.toUpperCase(chunks[i].charAt(0)));
				builder.append(chunks[i].substring(1));
			} 
Contextual code suggestions in your IDE  Get Codota for Java