/** * Create a temp file in the specified directory (if not null). * The file will be deleted when the JVM exits. */ public TempFile(File dir) throws IOException { file = File.createTempFile("pop3.", ".mbox", dir); // XXX - need JDK 6 to set permissions on the file to owner-only file.deleteOnExit(); sf = new WritableSharedFile(file); }
/** * Close and remove this temp file. */ public void close() { try { sf.close(); } catch (IOException ex) { // ignore it } file.delete(); }
/** * Return a stream for appending to the temp file. */ public AppendStream getAppendStream() throws IOException { return sf.getAppendStream(); }
public AppendStream(WritableSharedFile tf) throws IOException { this.tf = tf; raf = tf.getWritableFile(); start = raf.length(); raf.seek(start); }
public synchronized void close() throws IOException { end = tf.updateLength(); raf = null; // no more writing allowed }
public synchronized InputStream getInputStream() throws IOException { return tf.newStream(start, end); } }
public AppendStream(WritableSharedFile tf) throws IOException { this.tf = tf; raf = tf.getWritableFile(); start = raf.length(); raf.seek(start); }
@Override public synchronized void close() throws IOException { end = tf.updateLength(); raf = null; // no more writing allowed }
public synchronized InputStream getInputStream() throws IOException { return tf.newStream(start, end); } }
/** * Create a temp file in the specified directory (if not null). * The file will be deleted when the JVM exits. */ public TempFile(File dir) throws IOException { file = File.createTempFile("pop3.", ".mbox", dir); // XXX - need JDK 6 to set permissions on the file to owner-only file.deleteOnExit(); sf = new WritableSharedFile(file); }
public AppendStream(WritableSharedFile tf) throws IOException { this.tf = tf; raf = tf.getWritableFile(); start = raf.length(); raf.seek(start); }
@Override public synchronized void close() throws IOException { end = tf.updateLength(); raf = null; // no more writing allowed }
/** * Return a stream for appending to the temp file. */ public AppendStream getAppendStream() throws IOException { return sf.getAppendStream(); }
/** * Close and remove this temp file. */ public void close() { try { sf.close(); } catch (IOException ex) { // ignore it } file.delete(); }
public synchronized InputStream getInputStream() throws IOException { return tf.newStream(start, end); } }
/** * Create a temp file in the specified directory (if not null). * The file will be deleted when the JVM exits. */ public TempFile(File dir) throws IOException { file = File.createTempFile("pop3.", ".mbox", dir); // XXX - need JDK 6 to set permissions on the file to owner-only file.deleteOnExit(); sf = new WritableSharedFile(file); }
public AppendStream(WritableSharedFile tf) throws IOException { this.tf = tf; raf = tf.getWritableFile(); start = raf.length(); raf.seek(start); }
@Override public synchronized void close() throws IOException { end = tf.updateLength(); raf = null; // no more writing allowed }
/** * Return a stream for appending to the temp file. */ public AppendStream getAppendStream() throws IOException { return sf.getAppendStream(); }
/** * Close and remove this temp file. */ public void close() { try { sf.close(); } catch (IOException ex) { // ignore it } file.delete(); }