How can I indicate to the outputstream to start writing before the first character of file1?
package com.codegym.task.task18.task1819;
/*
Combining files
*/
import java.io.*;
public class Solution {
public static void main(String[] args) {
//Read 2 file names from the console.
try{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String fn1 = reader.readLine();
String fn2 = reader.readLine();
FileInputStream firstFileInuptStream = new FileInputStream(fn1);
while(firstFileInuptStream.available()>0){
int data = firstFileInuptStream.read();
}
FileInputStream inputStream = new FileInputStream(fn2);
FileOutputStream outputStream = new FileOutputStream(fn1);
while(inputStream.available()>0){
int data = inputStream.read();
// outputStream.getChannel(0);
outputStream.write("data".getBytes(), 0, "data".length());
firstFileInuptStream.close();
outputStream.close();
inputStream.close();
}
}catch(IOException e){
e.printStackTrace();
}
}
}