KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > nutch > mapReduce > FileSplit


1 /* Copyright (c) 2005 The Nutch Organization. All rights reserved. */
2 /* Use subject to the conditions in http://www.nutch.org/LICENSE.txt. */
3
4 package net.nutch.mapReduce;
5
6 import java.io.IOException JavaDoc;
7 import java.io.File JavaDoc;
8
9 import net.nutch.fs.NutchFileSystem;
10
11 /** An {@link InputFormat.Split} implementation for sections of files. */
12 public class FileSplit implements InputFormat.Split {
13   private NutchFileSystem fs;
14   private File JavaDoc file;
15   private long start;
16   private long length;
17   
18   /** Constructs a split.
19    *
20    * @param fs the {@link NutchFileSystem} the file lives in
21    * @param file the file name
22    * @param start the position of the first byte in the file to process
23    * @param length the number of bytes in the file to process
24    */

25   public FileSplit(NutchFileSystem fs, File JavaDoc file, long start, long length) {
26     this.fs = fs;
27     this.file = file;
28     this.start = start;
29     this.length = length;
30   }
31   
32   /** The file system containing this split's data. */
33   public NutchFileSystem getFileSystem() { return fs; }
34   
35   /** The file containing this split's data. */
36   public File JavaDoc getFile() { return file; }
37   
38   /** The position of the first byte in the file to process. */
39   public long getStart() { return start; }
40   
41   /** The number of bytes in the file to process. */
42   public long getLength() { return length; }
43 }
44
Popular Tags