synchronized void read(long pointer, byte[] buf, int offset, int length ) { try { raf.seek(pointer); raf.readFully(buf, offset, length); } catch(IOException ioe) { throw new MIMEParsingException(ioe); } }
synchronized void read(long pointer, byte[] buf, int offset, int length ) { try { raf.seek(pointer); raf.readFully(buf, offset, length); } catch(IOException ioe) { throw new MIMEParsingException(ioe); } }
synchronized void read(long pointer, byte[] buf, int offset, int length ) { try { raf.seek(pointer); raf.readFully(buf, offset, length); } catch(IOException ioe) { throw new MIMEParsingException(ioe); } }
synchronized void read(long pointer, byte[] buf, int offset, int length ) { try { raf.seek(pointer); raf.readFully(buf, offset, length); } catch(IOException ioe) { throw new MIMEParsingException(ioe); } }
synchronized long writeTo(long pointer, byte[] data, int offset, int length) { try { raf.seek(pointer); raf.write(data, offset, length); return raf.getFilePointer(); // Update pointer for next write } catch(IOException ioe) { throw new MIMEParsingException(ioe); } }
synchronized long writeTo(long pointer, byte[] data, int offset, int length) { try { raf.seek(pointer); raf.write(data, offset, length); return raf.getFilePointer(); // Update pointer for next write } catch(IOException ioe) { throw new MIMEParsingException(ioe); } }
synchronized long writeTo(long pointer, byte[] data, int offset, int length) { try { raf.seek(pointer); raf.write(data, offset, length); return raf.getFilePointer(); // Update pointer for next write } catch(IOException ioe) { throw new MIMEParsingException(ioe); } }
synchronized long writeTo(long pointer, byte[] data, int offset, int length) { try { raf.seek(pointer); raf.write(data, offset, length); return raf.getFilePointer(); // Update pointer for next write } catch(IOException ioe) { throw new MIMEParsingException(ioe); } }
void close() { LOGGER.fine("Deleting file = "+file.getName()); refList.remove(this); try { raf.close(); file.delete(); } catch(IOException ioe) { throw new MIMEParsingException(ioe); } }
void renameTo(File f) { LOGGER.fine("Moving file="+file+" to="+f); refList.remove(this); try { raf.close(); file.renameTo(f); } catch(IOException ioe) { throw new MIMEParsingException(ioe); } }
WeakDataFile(DataFile df, File file) { super(df, refQueue); refList.add(this); this.file = file; try { raf = new RandomAccessFile(file, "rw"); } catch(IOException ioe) { throw new MIMEParsingException(ioe); } drainRefQueueBounded(); }
WeakDataFile(DataFile df, File file) { super(df, refQueue); refList.add(this); this.file = file; try { raf = new RandomAccessFile(file, "rw"); } catch(IOException ioe) { throw new MIMEParsingException(ioe); } if (!hasCleanUpExecutor) { drainRefQueueBounded(); } }
WeakDataFile(DataFile df, File file) { super(df, refQueue); refList.add(this); this.file = file; try { raf = new RandomAccessFile(file, "rw"); } catch(IOException ioe) { throw new MIMEParsingException(ioe); } if (!hasCleanUpExecutor) { drainRefQueueBounded(); } }
if (!config.isOnlyMemory() && dataHead.inMemory >= config.memoryThreshold) { try { String prefix = config.getTempFilePrefix(); String suffix = config.getTempFileSuffix(); File dir = config.getTempDir(); File tempFile = (dir == null) ? File.createTempFile(prefix, suffix) // here your code crashes : File.createTempFile(prefix, suffix, dir); LOGGER.fine("Created temp file = "+tempFile); dataHead.dataFile = new DataFile(tempFile); } catch(IOException ioe) { throw new MIMEParsingException(ioe); }
void renameTo(File f) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Moving file={0} to={1}", new Object[]{file, f}); } refList.remove(this); try { raf.close(); Path target = Files.move(file.toPath(), f.toPath(), StandardCopyOption.REPLACE_EXISTING); boolean renamed = f.toPath().equals(target); if (!renamed) { if (LOGGER.isLoggable(Level.INFO)) { throw new MIMEParsingException("File " + file.getAbsolutePath() + " was not moved to " + f.getAbsolutePath()); } } } catch(IOException ioe) { throw new MIMEParsingException(ioe); } }