Advertisement
adwas33

Untitled

Jul 11th, 2023
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. import java.io.*;
  2.  
  3. public class Main {
  4. public static void main(String[] args) throws IOException, ClassNotFoundException {
  5. // Przykładowa tablica bajtów
  6. byte[] data = new byte[1024];
  7.  
  8. // Tworzenie ByteArrayInputStream
  9. ByteArrayInputStream bais = new ByteArrayInputStream(data);
  10.  
  11. // Tworzenie ObjectInputStream
  12. ObjectInputStream ois = new ObjectInputStream(bais);
  13.  
  14. // Odczytanie obiektu File
  15. File file = (File) ois.readObject();
  16.  
  17. // Zamknięcie strumieni
  18. ois.close();
  19. bais.close();
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement