public class TxtInputStream extends FileInputStream {
public TxtInputStream(String fileName) throws IOException, UnsupportedEncodingException {
super(fileName);
if (!fileName.endsWith(".txt")) {
super.close();
throw new UnsupportedEncodingException();
}
}
public static void main(String[] args) {
}
}
package com.javarush.task.task18.task1814;
import java.io.*;
/*
UnsupportedFileName
*/
public class TxtInputStream extends FileInputStream {
public TxtInputStream(String fileName) throws IOException, UnsupportedEncodingException {
super(fileName);
if (!fileName.endsWith(".txt")) {
super.close();
throw new UnsupportedEncodingException();
} else {
return;
}
}
public static void main(String[] args) {
}
}