daily pastebin goal
76%
SHARE
TWEET

Untitled

a guest Jun 19th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.javarush.task.task18.task1810;
  2.  
  3. /*
  4. DownloadException
  5. */
  6.  
  7. import java.io.BufferedReader;
  8. import java.io.FileInputStream;
  9. import java.io.IOException;
  10. import java.io.InputStreamReader;
  11.  
  12. public class Solution {
  13.     public static void main(String[] args) throws DownloadException, IOException {
  14.         BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  15.         String nameFile = reader.readLine();
  16.         FileInputStream fileInputStream = new FileInputStream(nameFile);
  17.         while (fileInputStream.available() > 1000){
  18.  
  19.             if (fileInputStream.available() < 1000){
  20.                 fileInputStream.close();
  21.                 throw new DownloadException();
  22.             }
  23.             nameFile = reader.readLine();
  24.             fileInputStream = new FileInputStream(nameFile);
  25.         }
  26.  
  27.  
  28.     }
  29.  
  30.     public static class DownloadException extends Exception {
  31.  
  32.     }
  33. }
RAW Paste Data
Top