public void close() throws IOException { dataEntryWriter.close(); dataEntryWriter = null; }
public boolean createDirectory(DataEntry dataEntry) throws IOException { // Try to create a directory with the first data entry writer, or // otherwise with the second data entry writer. return dataEntryWriter1.createDirectory(dataEntry) || dataEntryWriter2.createDirectory(dataEntry); }
public OutputStream createOutputStream(DataEntry dataEntry) throws IOException { // Try to get an output stream from the first data entry writer. OutputStream outputStream = dataEntryWriter1.createOutputStream(dataEntry); // Return it, if it's not null. Otherwise try to get an output stream // from the second data entry writer. return outputStream != null ? outputStream : dataEntryWriter2.createOutputStream(dataEntry); }
public boolean sameOutputStream(DataEntry dataEntry1, DataEntry dataEntry2) throws IOException { return dataEntryWriter.sameOutputStream(dataEntry1, dataEntry2); }
public void read(DataEntry dataEntry) throws IOException { try { if (dataEntry.isDirectory()) { dataEntryWriter.createDirectory(dataEntry); } else { // Get the output entry corresponding to this input entry. OutputStream outputStream = dataEntryWriter.getOutputStream(dataEntry); if (outputStream != null) { InputStream inputStream = dataEntry.getInputStream(); // Copy the data from the input entry to the output entry. copyData(inputStream, outputStream); // Close the data entries. dataEntry.closeInputStream(); } } } catch (IOException ex) { System.err.println("Warning: can't write resource [" + dataEntry.getName() + "] (" + ex.getMessage() + ")"); } }
public OutputStream getOutputStream(DataEntry dataEntry, Finisher finisher) throws IOException { // Try to get an output stream from the first data entry writer. OutputStream outputStream = dataEntryWriter1.getOutputStream(dataEntry, finisher); // Return it, if it's not null. Otherwise try to get an output stream // from the second data entry writer. return outputStream != null ? outputStream : dataEntryWriter2.getOutputStream(dataEntry, finisher); }
public boolean sameOutputStream(DataEntry dataEntry1, DataEntry dataEntry2) throws IOException { return dataEntryWriter1.sameOutputStream(dataEntry1, dataEntry2) || dataEntryWriter2.sameOutputStream(dataEntry1, dataEntry2); }
public OutputStream getOutputStream(DataEntry dataEntry, Finisher finisher) throws IOException { return dataEntryWriter.getOutputStream(dataEntry.getParent(), finisher); }
public boolean createDirectory(DataEntry dataEntry) throws IOException { // Try to create a directory with the first data entry writer, or // otherwise with the second data entry writer. return dataEntryWriter1.createDirectory(dataEntry) || dataEntryWriter2.createDirectory(dataEntry); }
public void close() throws IOException { // Close the parent stream. dataEntryWriter.close(); }
public void read(DataEntry dataEntry) throws IOException { // Get the output entry corresponding to this input entry, but don't // even try to close it. dataEntryWriter.createOutputStream(dataEntry); } }
public boolean sameOutputStream(DataEntry dataEntry1, DataEntry dataEntry2) throws IOException { return dataEntryWriter.sameOutputStream(dataEntry1, dataEntry2); }
public OutputStream getOutputStream(DataEntry dataEntry, Finisher finisher) throws IOException { // Get the right data entry writer. DataEntryWriter dataEntryWriter = dataEntryFilter.accepts(dataEntry) ? acceptedDataEntryWriter : rejectedDataEntryWriter; // Delegate to it, if it's not null. return dataEntryWriter != null ? dataEntryWriter.getOutputStream(dataEntry, finisher) : null; }
public boolean createDirectory(DataEntry dataEntry) throws IOException { // Try to create a directory with the first data entry writer, or // otherwise with the second data entry writer. return dataEntryWriter1.createDirectory(dataEntry) || dataEntryWriter2.createDirectory(dataEntry); }
public void println(PrintWriter pw, String prefix) { pw.println(prefix + "ParentDataEntryWriter"); dataEntryWriter.println(pw, prefix + " "); } }
public void read(DataEntry dataEntry) throws IOException { // Get the output entry corresponding to this input entry, but don't // even try to close it. dataEntryWriter.createOutputStream(dataEntry); } }