Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) throws Exception {
- FileInputStream inputStream = new FileInputStream("c:/data.txt");
- FileOutputStream outputStream = new FileOutputStream("c:/result.txt");
- byte[] buffer = new byte[1000];
- while (inputStream.available() > 0){
- int count = inputStream.read(buffer);
- outputStream.write(buffer, 0, count);
- }
- inputStream.close();
- outputStream.close();
- }
- private void writeFile(File file, byte[] bytes) {
- BufferedOutputStream bos = null;
- try {
- bos = new BufferedOutputStream(new FileOutputStream(file));
- bos.write(bytes);
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- if (image != null) {
- image.close();
- }
- if (null != bos) {
- try {
- bos.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment