Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.annotation.processing.SupportedSourceVersion;
- import java.io.*;
- import java.util.logging.Filter;
- public class Main {
- public static void main(String[] args){
- BufferedInputStream bis = null;
- BufferedOutputStream bos = null;
- try {
- InputStream in = new FileInputStream("izvor.txt");
- bis = new BufferedInputStream(in);
- OutputStream out = new FileOutputStream("destinacija.txt");
- bos = new BufferedOutputStream(out);
- BufferedReader bf = new BufferedReader(new InputStreamReader(bis));
- while(bf.ready()) {
- String s = bf.readLine();
- if(s.charAt(0) >= '0' && s.charAt(0) <= '9') {
- bos.write(s.getBytes());
- bos.write(10);
- }
- }
- bos.flush();
- }
- catch (IOException ex ){
- }
- finally {
- try {
- if(bis != null)
- bis.close();
- if(bos != null)
- bos.close();
- }
- catch (IOException e) {
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement