Closed HelmutL closed 9 months ago
Hi
A new method will be available in 2.0 to override default, and force to read memo fieds as binary
setReadMemoFieldAsBinary
You must call this method before read the data
Example:
File file = new File("src/test/resources/fixtures/dbase_8b.dbf");
DBFReader reader = null;
try {
reader = new DBFReader( new BufferedInputStream(new FileInputStream(file)));
reader.setMemoFile(new File("src/test/resources/fixtures/dbase_8b.dbt"));
reader.setReadMemoFieldsAsBinary("MEMO");
DBFRow row = null;
while ((row = reader.nextRow()) != null) {
byte[] data = row.getBytes("MEMO");
// Do whatever you wan't with de data
}
}
finally {
DBFUtils.close(reader);
}
Hi,
just in case you might be interested. I had the challenge to create files useable by existing VFP (Visual FoxPro) programs, also having memory files.
I wrote a "quick and dirty" class DBFWrite2 (derived from DBFWRITE) to make it possible. It certainly would need a better integration to javadbf and error checking.
To achieve this, I had to do some modifications in existing modules:
DBFMemoFile: allow write access („r“ → „rw“) routines to write the memo field in close() set next free position
DBFField: allow write for MEMO fields
DBFHeader: getMdxFlag() setMdxFlag() set the type of CDX index (byte 28)
setSignature() file type (byte 0)
Attached the sources
Regards Helmut Leiniinger
-- Diese E-Mail wurde von Avast-Antivirussoftware auf Viren geprüft. www.avast.com
Hi @HelmutL
The files are missed. Maybe you can upload the files on the issue related to write memo files #40
I have a file in an application that has been written using Visual Foxpro. The file contains MEMO type fields. The byte 18 of the field definition is 0x00, The byte 3 in the Memo Block Header (in the memofile) is set to 0x01 (text).
Nevertheless, this field contains images (e.g. JPG type) and it seems Visual Foxpro does not care.
Now, reading these fields by DBFReader converts them to String, which makes the data unusable, even if converted to byte[] by String.getBytes();
I need a possiblity to bypass this conversion and read the field's "raw data" to a byte[].
Regards