import java.io.*;
import java.util.*;
/*
Extending AmigoOutputStream
*/
public class QuestionFileOutputStream implements AmigoOutputStream {
private AmigoOutputStream or;
public QuestionFileOutputStream (AmigoOutputStream aos){
this.or = aos;
}
public void flush() throws IOException{
or.flush();
}
public void write(int b) throws IOException{
or.write(b);
}
public void write(byte[] b) throws IOException{
or.write(b);
}
public void write(byte[] b, int off, int len) throws IOException{
or.write(b, off, len);
}
public void close() throws IOException{
try{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Do you really want to close the stream? Y/N");
String line = "";
do {line = reader.readLine();}
while (!line.equals("Y"));
reader.close();
}
catch(Exception e){}
}
}
package com.codegym.task.task18.task1812;
import java.io.IOException;
public interface AmigoOutputStream {
void flush() throws IOException;
void write(int b) throws IOException;
void write(byte[] b) throws IOException;
void write(byte[] b, int off, int len) throws IOException;
void close() throws IOException;
}