'Java read .cdr-File
right now I#m trying to write a program which reads a .cdr-File. The Format of the CDR-File looks like this:
***************
* File header *
***************
File length: 44142 bytes
Header length: 54 bytes
High release identifier: Check the field extension below
High version identifier: Version 6
Low release identifier: Check the field extension below
Low version identifier: Version 6
File opening local timestamp: May 20 00:28 (+02:00 from UTC)
Timestamp of last CDR on file: May 20 01:28 (+02:00 from UTC)
Number of CDRs in the file: 130 CDRs
File sequence number: 386
File closure trigger reason: File open-time limit reached
IP address of node generating the file: ff.ff.ff.ff::ffff:ac10:1438
Lost CDR indicator: 0 CDRs lost
Length of CDR routeing filter: 0 bytes
Length of private extensions: 0 bytes
High release ID extension: Release 13
Low release ID extension: Release 13
This is my code:
readBinary-method:
public Collection<Data> readBinary(String file) throws IOException, FileNotFoundException
{
ArrayList<Data> arrayList=new ArrayList<>();
try(DataInputStream dis=new DataInputStream(new BufferedInputStream(new FileInputStream(file))))
{
while (dis.available()>0)
{
arrayList.add(new Data(dis.readUTF(), dis.readUTF(), dis.readUTF(), dis.readUTF(), dis.readUTF(), dis.readUTF(),dis.readUTF(), dis.readUTF(), dis.readUTF(), dis.readUTF(), dis.readInt(), dis.readUTF(), dis.readUTF(), dis.readUTF(), dis.readUTF(), dis.readUTF(), dis.readUTF(), dis.readUTF()));
}
}
return arrayList;
}
main:
public class Main implements Serializable
{
public static void main(String[] args) throws IOException, ClassNotFoundException {
Methoden m = new Methoden();
try {
ArrayList<Data> d1 = (ArrayList<Data>) m.readBinary("172.16.20.5601_-_386.20210520_-_0128+0200.cdr");
System.out.println(d1);
} catch (IOException e) {
e.printStackTrace();
}
}
}
So my problem is, when i run the program I get an EOFException and I don't get why..
Maybe someone can help me with my problem
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|