Author: cutting Date: Thu Sep 29 13:43:53 2005 New Revision: 292539 URL: http://svn.apache.org/viewcvs?rev=292539&view=rev Log: Change so that default is to overwrite existing files, as this is normal under MapReduce, when tasks may be re-executed.
Modified: lucene/nutch/branches/mapred/src/java/org/apache/nutch/fs/LocalFileSystem.java lucene/nutch/branches/mapred/src/java/org/apache/nutch/fs/NutchFileSystem.java lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/NDFSClient.java Modified: lucene/nutch/branches/mapred/src/java/org/apache/nutch/fs/LocalFileSystem.java URL: http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/java/org/apache/nutch/fs/LocalFileSystem.java?rev=292539&r1=292538&r2=292539&view=diff ============================================================================== --- lucene/nutch/branches/mapred/src/java/org/apache/nutch/fs/LocalFileSystem.java (original) +++ lucene/nutch/branches/mapred/src/java/org/apache/nutch/fs/LocalFileSystem.java Thu Sep 29 13:43:53 2005 @@ -95,13 +95,6 @@ return new LocalNFSFileInputStream(f); } - /** - * Create the file at f. - */ - public NFSOutputStream create(File f) throws IOException { - return create(f, false); - } - /********************************************************* * For create()'s NFSOutputStream. *********************************************************/ @@ -128,8 +121,6 @@ public void write(int b) throws IOException { fos.write(b); } } - /** - */ public NFSOutputStream create(File f, boolean overwrite) throws IOException { if (f.exists() && ! overwrite) { throw new IOException("File already exists:"+f); Modified: lucene/nutch/branches/mapred/src/java/org/apache/nutch/fs/NutchFileSystem.java URL: http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/java/org/apache/nutch/fs/NutchFileSystem.java?rev=292539&r1=292538&r2=292539&view=diff ============================================================================== --- lucene/nutch/branches/mapred/src/java/org/apache/nutch/fs/NutchFileSystem.java (original) +++ lucene/nutch/branches/mapred/src/java/org/apache/nutch/fs/NutchFileSystem.java Thu Sep 29 13:43:53 2005 @@ -122,10 +122,18 @@ public abstract NFSInputStream open(File f) throws IOException; /** - * Opens an OutputStream at the indicated File, whether local - * or via NDFS. + * Opens an OutputStream at the indicated File. + * Files are overwritten by default. + */ + public NFSOutputStream create(File f) throws IOException { + return create(f, true); + } + + /** Opens an OutputStream at the indicated File. + * @param f the file name to open + * @param overwrite if a file with this name already exists, then if true, + * the file will be overwritten, and if false an error will be thrown. */ - public abstract NFSOutputStream create(File f) throws IOException; public abstract NFSOutputStream create(File f, boolean overwrite) throws IOException; /** Modified: lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/NDFSClient.java URL: http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/NDFSClient.java?rev=292539&r1=292538&r2=292539&view=diff ============================================================================== --- lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/NDFSClient.java (original) +++ lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/NDFSClient.java Thu Sep 29 13:43:53 2005 @@ -71,14 +71,6 @@ return new NDFSInputStream(src.toString()); } - /** - * Create an output stream that writes to all the right places. - * Basically creates instance of inner subclass of OutputStream - * that handles datanode/namenode negotiation. - */ - public NFSOutputStream create(UTF8 src) throws IOException { - return create(src, false); - } public NFSOutputStream create(UTF8 src, boolean overwrite) throws IOException { return new NDFSOutputStream(src, overwrite); }