I tried to read content and write it to file. The code run on server when the server is on linux I don't have any problem. when I run it on windows for any string in the end I got another space How I can fix it ?
public static void readFile(InputStream inputStream, OutputStream outputStream, boolean closeIn, boolean closeOut) throws IOException {
byte[] buffer = new byte[4096];
int read = 0;
try {
while ((read = inputStream.read(buffer)) != -1)
outputStream.write(buffer, 0, read);
} finally {
//close input and output
}
}