Created
October 2, 2012 15:34
-
-
Save geofferyzh/3820212 to your computer and use it in GitHub Desktop.
Hadoop 101 - Read a local file using bufferreader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.FileReader; | |
import java.io.IOException; | |
public static final String InitialActivationList = "/.../Initial_Activation_List.txt"; | |
String toBeActivated; | |
public void loadInitialActivation(String InitialActivationList, int linenum_index) throws IOException { | |
String line; | |
int linenum = 0; | |
BufferedReader bufferedReader = new BufferedReader(new FileReader(InitialActivationList)); | |
while ((line = bufferedReader.readLine()) != null) { | |
linenum = linenum + 1; | |
if (linenum == linenum_index) { | |
toBeActivated = line.toString(); | |
break; | |
} | |
} | |
bufferedReader.close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment