/** * Returns a <code>ManagedOutputStream</code> for a managed file. * Closing the ouput stream will update the storage manager with the * new content of the managed file. * * @param managedFile the name of the managed file to write. * @return a managed output stream for the managed file. * @throws IOException if an error occurs opening the managed file. */ public ManagedOutputStream getOutputStream(String managedFile) throws IOException { if (useReliableFiles) { ReliableFileOutputStream out = new ReliableFileOutputStream(new File(getBase(), managedFile)); return new ManagedOutputStream(out, this, managedFile, null); } File tmpFile = createTempFile(managedFile); return new ManagedOutputStream(new FileOutputStream(tmpFile), this, managedFile, tmpFile); }
/** * Returns an array of <code>ManagedOutputStream</code> for a set of managed files. * When all managed output streams in the set have been closed, the storage manager * will be updated with the new content of the managed files. * Aborting any one of the streams will cause the entire content of the set to abort * and be discarded. * * @param managedFiles list of names of the managed file to write. * @return an array of managed output streams respectively of managed files. * @throws IOException if an error occurs opening the managed files. */ public ManagedOutputStream[] getOutputStreamSet(String[] managedFiles) throws IOException { int count = managedFiles.length; ManagedOutputStream[] streams = new ManagedOutputStream[count]; int idx = 0; try { for (; idx < count; idx++) { ManagedOutputStream newStream = getOutputStream(managedFiles[idx]); newStream.setStreamSet(streams); streams[idx] = newStream; } } catch (IOException e) { // cleanup for (int jdx = 0; jdx < idx; jdx++) streams[jdx].abort(); throw e; } return streams; }
void abortOutputStream(ManagedOutputStream out) { ManagedOutputStream[] set = out.getStreamSet(); if (set == null) { set = new ManagedOutputStream[] {out}; } synchronized (set) { for (int idx = 0; idx < set.length; idx++) { out = set[idx]; if (out.getOutputFile() == null) { // this is a ReliableFileOutpuStream ReliableFileOutputStream rfos = (ReliableFileOutputStream) out.getOutputStream(); rfos.abort(); } else { // plain FileOutputStream(); if (out.getState() == ManagedOutputStream.ST_OPEN) { try { out.getOutputStream().close(); } catch (IOException e) {/*do nothing*/ } } out.getOutputFile().delete(); } out.setState(ManagedOutputStream.ST_CLOSED); } } }
fmos.abort(); try { out.close();
fmos.abort(); try { out.close();
void abortOutputStream(ManagedOutputStream out) { ManagedOutputStream[] set = out.getStreamSet(); if (set == null) { set = new ManagedOutputStream[] {out}; } synchronized (set) { for (int idx = 0; idx < set.length; idx++) { out = set[idx]; if (out.getOutputFile() == null) { // this is a ReliableFileOutpuStream ReliableFileOutputStream rfos = (ReliableFileOutputStream) out.getOutputStream(); rfos.abort(); } else { // plain FileOutputStream(); if (out.getState() == ManagedOutputStream.ST_OPEN) { try { out.getOutputStream().close(); } catch (IOException e) {/*do nothing*/ } } out.getOutputFile().delete(); } out.setState(ManagedOutputStream.ST_CLOSED); } } }
/** * Returns an array of <code>ManagedOutputStream</code> for a set of managed files. * When all managed output streams in the set have been closed, the storage manager * will be updated with the new content of the managed files. * Aborting any one of the streams will cause the entire content of the set to abort * and be discarded. * * @param managedFiles list of names of the managed file to write. * @return an array of managed output streams respectively of managed files. * @throws IOException if an error occurs opening the managed files. */ public ManagedOutputStream[] getOutputStreamSet(String[] managedFiles) throws IOException { int count = managedFiles.length; ManagedOutputStream[] streams = new ManagedOutputStream[count]; int idx = 0; try { for (; idx < count; idx++) { ManagedOutputStream newStream = getOutputStream(managedFiles[idx]); newStream.setStreamSet(streams); streams[idx] = newStream; } } catch (IOException e) { // cleanup for (int jdx = 0; jdx < idx; jdx++) streams[jdx].abort(); throw e; } return streams; }
/** * Returns a <code>ManagedOutputStream</code> for a managed file. * Closing the ouput stream will update the storage manager with the * new content of the managed file. * * @param managedFile the name of the managed file to write. * @return a managed output stream for the managed file. * @throws IOException if an error occurs opening the managed file. */ public ManagedOutputStream getOutputStream(String managedFile) throws IOException { if (useReliableFiles) { ReliableFileOutputStream out = new ReliableFileOutputStream(new File(getBase(), managedFile)); return new ManagedOutputStream(out, this, managedFile, null); } File tmpFile = createTempFile(managedFile); return new ManagedOutputStream(new FileOutputStream(tmpFile), this, managedFile, tmpFile); }
fmos.abort(); try { out.close();
void abortOutputStream(ManagedOutputStream out) { ManagedOutputStream[] set = out.getStreamSet(); if (set == null) { set = new ManagedOutputStream[] {out}; } synchronized (set) { for (int idx = 0; idx < set.length; idx++) { out = set[idx]; if (out.getOutputFile() == null) { // this is a ReliableFileOutpuStream ReliableFileOutputStream rfos = (ReliableFileOutputStream) out.getOutputStream(); rfos.abort(); } else { // plain FileOutputStream(); if (out.getState() == ManagedOutputStream.ST_OPEN) { try { out.getOutputStream().close(); } catch (IOException e) {/*do nothing*/ } } out.getOutputFile().delete(); } out.setState(ManagedOutputStream.ST_CLOSED); } } }
/** * Returns an array of <code>ManagedOutputStream</code> for a set of managed files. * When all managed output streams in the set have been closed, the storage manager * will be updated with the new content of the managed files. * Aborting any one of the streams will cause the entire content of the set to abort * and be discarded. * * @param managedFiles list of names of the managed file to write. * @return an array of managed output streams respectively of managed files. * @throws IOException if an error occurs opening the managed files. */ public ManagedOutputStream[] getOutputStreamSet(String[] managedFiles) throws IOException { int count = managedFiles.length; ManagedOutputStream[] streams = new ManagedOutputStream[count]; int idx = 0; try { for (; idx < count; idx++) { ManagedOutputStream newStream = getOutputStream(managedFiles[idx]); newStream.setStreamSet(streams); streams[idx] = newStream; } } catch (IOException e) { // cleanup for (int jdx = 0; jdx < idx; jdx++) streams[jdx].abort(); throw e; } return streams; }
/** * Returns a <code>ManagedOutputStream</code> for a managed file. * Closing the ouput stream will update the storage manager with the * new content of the managed file. * * @param managedFile the name of the managed file to write. * @return a managed output stream for the managed file. * @throws IOException if an error occurs opening the managed file. */ public ManagedOutputStream getOutputStream(String managedFile) throws IOException { if (useReliableFiles) { ReliableFileOutputStream out = new ReliableFileOutputStream(new File(getBase(), managedFile)); return new ManagedOutputStream(out, this, managedFile, null); } File tmpFile = createTempFile(managedFile); return new ManagedOutputStream(new FileOutputStream(tmpFile), this, managedFile, tmpFile); }
fmos.abort(); try { out.close();
void abortOutputStream(ManagedOutputStream out) { ManagedOutputStream[] set = out.getStreamSet(); if (set == null) { set = new ManagedOutputStream[] {out}; } synchronized (set) { for (int idx = 0; idx < set.length; idx++) { out = set[idx]; if (out.getOutputFile() == null) { // this is a ReliableFileOutpuStream ReliableFileOutputStream rfos = (ReliableFileOutputStream) out.getOutputStream(); rfos.abort(); } else { // plain FileOutputStream(); if (out.getState() == ManagedOutputStream.ST_OPEN) { try { out.getOutputStream().close(); } catch (IOException e) {/*do nothing*/ } } out.getOutputFile().delete(); } out.setState(ManagedOutputStream.ST_CLOSED); } } }
/** * Returns an array of <code>ManagedOutputStream</code> for a set of managed files. * When all managed output streams in the set have been closed, the storage manager * will be updated with the new content of the managed files. * Aborting any one of the streams will cause the entire content of the set to abort * and be discarded. * * @param managedFiles list of names of the managed file to write. * @return an array of managed output streams respectively of managed files. * @throws IOException if an error occurs opening the managed files. */ public ManagedOutputStream[] getOutputStreamSet(String[] managedFiles) throws IOException { int count = managedFiles.length; ManagedOutputStream[] streams = new ManagedOutputStream[count]; int idx = 0; try { for (; idx < count; idx++) { ManagedOutputStream newStream = getOutputStream(managedFiles[idx]); newStream.setStreamSet(streams); streams[idx] = newStream; } } catch (IOException e) { // cleanup for (int jdx = 0; jdx < idx; jdx++) streams[jdx].abort(); throw e; } return streams; }
/** * Returns a <code>ManagedOutputStream</code> for a managed file. * Closing the ouput stream will update the storage manager with the * new content of the managed file. * * @param managedFile the name of the managed file to write. * @return a managed output stream for the managed file. * @throws IOException if an error occurs opening the managed file. */ public ManagedOutputStream getOutputStream(String managedFile) throws IOException { if (useReliableFiles) { ReliableFileOutputStream out = new ReliableFileOutputStream(new File(getBase(), managedFile)); return new ManagedOutputStream(out, this, managedFile, null); } File tmpFile = createTempFile(managedFile); return new ManagedOutputStream(new FileOutputStream(tmpFile), this, managedFile, tmpFile); }
if (!success) { if (mos != null) { mos.abort();
void abortOutputStream(ManagedOutputStream out) { ManagedOutputStream[] set = out.getStreamSet(); if (set == null) { set = new ManagedOutputStream[] {out}; } synchronized (set) { for (int idx = 0; idx < set.length; idx++) { out = set[idx]; if (out.getOutputFile() == null) { // this is a ReliableFileOutpuStream ReliableFileOutputStream rfos = (ReliableFileOutputStream) out.getOutputStream(); rfos.abort(); } else { // plain FileOutputStream(); if (out.getState() == ManagedOutputStream.ST_OPEN) { try { out.getOutputStream().close(); } catch (IOException e) {/*do nothing*/ } } out.getOutputFile().delete(); } out.setState(ManagedOutputStream.ST_CLOSED); } } }
/** * Returns an array of <code>ManagedOutputStream</code> for a set of managed files. * When all managed output streams in the set have been closed, the storage manager * will be updated with the new content of the managed files. * Aborting any one of the streams will cause the entire content of the set to abort * and be discarded. * * @param managedFiles list of names of the managed file to write. * @return an array of managed output streams respectively of managed files. * @throws IOException if an error occurs opening the managed files. */ public ManagedOutputStream[] getOutputStreamSet(String[] managedFiles) throws IOException { int count = managedFiles.length; ManagedOutputStream[] streams = new ManagedOutputStream[count]; int idx = 0; try { for (; idx < count; idx++) { ManagedOutputStream newStream = getOutputStream(managedFiles[idx]); newStream.setStreamSet(streams); streams[idx] = newStream; } } catch (IOException e) { // cleanup for (int jdx = 0; jdx < idx; jdx++) streams[jdx].abort(); throw e; } return streams; }
/** * Returns a <code>ManagedOutputStream</code> for a managed file. * Closing the ouput stream will update the storage manager with the * new content of the managed file. * * @param managedFile the name of the managed file to write. * @return a managed output stream for the managed file. * @throws IOException if an error occurs opening the managed file. */ public ManagedOutputStream getOutputStream(String managedFile) throws IOException { if (useReliableFiles) { ReliableFileOutputStream out = new ReliableFileOutputStream(new File(getBase(), managedFile)); return new ManagedOutputStream(out, this, managedFile, null); } File tmpFile = createTempFile(managedFile); return new ManagedOutputStream(new FileOutputStream(tmpFile), this, managedFile, tmpFile); }