()
| 242 | boolean disableWrites = false; |
| 243 | |
| 244 | public void readLibraryFromDisk() { |
| 245 | disableWrites = true; |
| 246 | ObjectInputStream in = null; |
| 247 | try { |
| 248 | File mediaCatalogFile = getMediaLibaryCatalog(); |
| 249 | if (!mediaCatalogFile.exists()) { |
| 250 | return; |
| 251 | } |
| 252 | FileInputStream fileStream = new FileInputStream(mediaCatalogFile); |
| 253 | in = new ObjectInputStream(fileStream); |
| 254 | while (fileStream.available() > 0) { |
| 255 | MediaEntry e = (MediaEntry) in.readObject(); |
| 256 | add(e); |
| 257 | } |
| 258 | } catch (IOException | ClassNotFoundException ex) { |
| 259 | Utility.gripe(ex.getMessage()); |
| 260 | Logger.getLogger(MediaCache.class.getName()).log(Level.SEVERE, null, ex); |
| 261 | } finally { |
| 262 | disableWrites = false; |
| 263 | try { |
| 264 | if (in != null) { |
| 265 | in.close(); |
| 266 | } |
| 267 | } catch (IOException ex) { |
| 268 | Logger.getLogger(MediaCache.class.getName()).log(Level.SEVERE, null, ex); |
| 269 | } |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | public void writeLibraryToDisk() { |
| 274 | ObjectOutputStream out = null; |
no test coverage detected