import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
public class MyClass {
public static void main(String args[]) throws IOException {
String str = "Java object-oriented programming language";
InputStream inputStream = new ByteArrayInputStream(str.getBytes());
OutputStream outputStream = new FileOutputStream("data.txt");
byte[] bytearray = new byte[str.length()];
while ((inputStream.read(bytearray)) > 0) {
outputStream.write(bytearray, 0, str.length());
}
String out = new String(bytearray, StandardCharsets.UTF_8);
System.out.println(out);
inputStream.close();
outputStream.close();
}
}
/*
run:
Java object-oriented programming language
*/