Revision 24925 branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/utils/DbaseFile.java
DbaseFile.java | ||
---|---|---|
264 | 264 |
|
265 | 265 |
public void setFieldValue(int rowIndex, int fieldId, Object obj) throws UnsupportedEncodingException, WriteException { |
266 | 266 |
try{ |
267 |
int fieldOffset = myHeader.getFieldDescription(fieldId).myFieldDataAddress; |
|
268 |
String str = fieldString(obj, fieldId); |
|
269 |
byte[] data = new byte[myHeader.getFieldLength(fieldId)]; |
|
270 |
recordOffset = (myHeader.getRecordLength() * rowIndex) |
|
271 |
+ myHeader.getHeaderLength() + 1; |
|
267 |
int fieldOffset = myHeader.getFieldDescription(fieldId).myFieldDataAddress;
|
|
268 |
String str = fieldString(obj, fieldId);
|
|
269 |
byte[] data = new byte[myHeader.getFieldLength(fieldId)];
|
|
270 |
recordOffset = (myHeader.getRecordLength() * rowIndex)
|
|
271 |
+ myHeader.getHeaderLength() + 1;
|
|
272 | 272 |
|
273 |
ByteBuffer aux = ByteBuffer.wrap(data); |
|
274 |
aux.put(str.getBytes(chars.name())); |
|
275 |
// raf.seek(recordOffset + fieldOffset); |
|
276 |
// raf.writeBytes(str); |
|
277 |
aux.flip(); |
|
278 |
int numBytesWritten = channel.write(aux, recordOffset + fieldOffset); |
|
279 |
//channel.force(true); |
|
273 |
ByteBuffer aux = ByteBuffer.wrap(data); |
|
274 |
aux.put(str.getBytes(chars.name())); |
|
275 |
// raf.seek(recordOffset + fieldOffset); |
|
276 |
// raf.writeBytes(str); |
|
277 |
aux.flip(); |
|
278 |
// int numBytesWritten = channel.write(aux, recordOffset + fieldOffset); |
|
279 |
channel.write(aux, recordOffset + fieldOffset); |
|
280 |
//channel.force(true); |
|
280 | 281 |
}catch (java.io.UnsupportedEncodingException e) { |
281 | 282 |
throw new UnsupportedEncodingException(e); |
282 | 283 |
}catch (IOException e) { |
... | ... | |
359 | 360 |
|
360 | 361 |
/** |
361 | 362 |
* read the DBF file into memory. |
362 |
*
|
|
363 |
* |
|
363 | 364 |
* @param file |
364 | 365 |
* DOCUMENT ME! |
365 | 366 |
* @throws FileNotFoundException |
366 | 367 |
* @throws UnsupportedVersionException |
367 | 368 |
* @throws IOException |
368 |
*
|
|
369 |
* |
|
369 | 370 |
* @throws IOException |
370 | 371 |
* DOCUMENT ME! |
371 | 372 |
*/ |
Also available in: Unified diff