Code example for ByteArrayOutputStream

Methods: toByteArray

0
		 
		ImporterV4 importer = new ImporterV4();
		PwDatabaseV4 db = importer.openDatabase(is, "12345", "");
		is.close();
		 
		ByteArrayOutputStream bos = new ByteArrayOutputStream();
		 
		PwDbV4Output output =  (PwDbV4Output) PwDbOutput.getInstance(db, bos);
		output.output();
		 
		byte[] data = bos.toByteArray();
		 
		FileOutputStream fos = new FileOutputStream("/sdcard/test-out.kdbx", false);
		 
		InputStream bis = new ByteArrayInputStream(data);
		bis = new CopyInputStream(bis, fos);
		importer = new ImporterV4();
		db = importer.openDatabase(bis, "12345", "");
		bis.close();
		 
		fos.close();