(
DataOutputStream ostream,
String name, int index,
boolean rewrite)
| 69 | } |
| 70 | |
| 71 | static public boolean writeFileRecord ( |
| 72 | DataOutputStream ostream, |
| 73 | String name, int index, |
| 74 | boolean rewrite) |
| 75 | { |
| 76 | ByteArrayOutputStream lbaos=baos; |
| 77 | baos=null; // освободим для следующего |
| 78 | byte[] b=lbaos.toByteArray(); |
| 79 | |
| 80 | |
| 81 | try { |
| 82 | if (rewrite) RecordStore.deleteRecordStore(name); |
| 83 | } catch (Exception e) {} |
| 84 | |
| 85 | RecordStore recordStore; |
| 86 | try { |
| 87 | recordStore = RecordStore.openRecordStore(name, true); |
| 88 | } catch (Exception e) { return false;} |
| 89 | |
| 90 | try { |
| 91 | try { |
| 92 | recordStore.setRecord(index+1, b, 0, b.length); |
| 93 | } catch (InvalidRecordIDException e) { recordStore.addRecord(b, 0, b.length); } |
| 94 | recordStore.closeRecordStore(); |
| 95 | ostream.flush(); |
| 96 | ostream.close(); |
| 97 | } catch (Exception e) { |
| 98 | return false; |
| 99 | } |
| 100 | |
| 101 | return true; |
| 102 | } |
| 103 | } |
no test coverage detected