Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package dexterJuni;
- import java.io.FileInputStream;
- import java.io.IOException;
- import java.util.*;
- public class Lista {
- public static List<byte[]> read(String input) throws IOException{
- //42658374445741237
- List<byte[]> lista = new ArrayList<byte[]>();
- FileInputStream reader = null;
- try {
- reader = new FileInputStream(input);
- int n;
- while((n = reader.read()) != -1) {
- int intValue = n - '0';
- byte[] buffer = new byte[intValue];
- for(int i=0; i<intValue; i++) {
- buffer[i] = (byte)reader.read();
- }
- lista.add(buffer);
- }
- }catch (Exception e) {}
- finally {
- if(reader != null)
- reader.close();
- }
- return lista;
- }
- public static void main(String[] args) throws IOException {
- // TODO Auto-generated method stub
- List<byte[]> lista = read("from.txt");
- System.out.print("[");
- for(byte[] pole: lista) {
- System.out.print("[");
- for(byte b: pole) {
- System.out.print((char)b);
- }
- System.out.print("]");
- }
- System.out.print("]");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement