Advertisement
Josif_tepe

Untitled

Mar 23rd, 2021
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. import java.io.*;
  2. public class Main {
  3.  
  4.     public static void main(String[] args) {
  5.         FileInputStream in = null;
  6.         try {
  7.              in = new FileInputStream("in.txt");
  8.             byte[] b = new byte[in.available()];
  9.             in.read(b);
  10.             for(int i = 0; i < b.length; i++) {
  11.                 System.out.write(b[i]);
  12.             }
  13.  
  14.         }
  15.         catch (IOException ex) {
  16.             System.out.println(ex);
  17.         }
  18.         finally {
  19.             try {
  20.                 if(in != null)
  21.                      in.close();
  22.             }
  23.             catch (IOException ex) {
  24.                 System.out.println(ex);
  25.             }
  26.         }
  27.     System.out.flush();
  28.     }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement