Last updated September 29, 2009 20:53, by gorbeia
= AEB 43 for Java Wiki =
== Documentation ==
[http://www.respuestaprofesional.com/AEB/PDFs/Norma_43_Ingles.pdf Documentation for AEB 43 format ]
=== Getting Aeb43forJava ===
==== requirements ====
* Java 1.5 or superior
* ant
==== download ====
TODO
==== build ====
Just run ant inside the downloaded folder.
=== Reading an AEB43 file ===
<pre name="java">
// A file may have more than one account
List<Account> accounts = new ArrayList<Account>();
// Just a reader, use the one that fits your needs
FileReader fr;
try {
fr = new FileReader("/path/to/file");
} catch (FileNotFoundException ex) {
System.err.println("File not found.");
System.exit(1);
return;
}
AccountReader accountReader = new AccountReader(fr);
RecordReader recordReader;
Account account;
// Iterate for each account in the file
while (accountReader.hasNext()) {
account = new Account();
recordReader = accountReader.next();
account.setAccountData(recordReader.getAccountData());
// Iterate for each record in the file
while (recordReader.hasNext()) {
account.appendRecord(recordReader.next());
}
accounts.add(account);
}
</pre>
=== Even simpler ===
<pre name="java">
// A file may have more than one account
List<Account> accounts = new ArrayList<Account>();
// Just a reader, use the one that fits your needs
FileReader fr;
try {
fr = new FileReader("/path/to/file");
} catch (FileNotFoundException ex) {
System.err.println("File not found.");
System.exit(1);
return;
}
// Really simple
SimpleAccountReader reader = new SimpleAccountReader(fr);
while (reader.hasNext()) {
accounts.add(reader.next());
}
</pre>





