Created
January 28, 2014 03:34
-
-
Save marcoonroad/8661871 to your computer and use it in GitHub Desktop.
Um simples BeanShell script que "printa" o própio source code.
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
// declare function // | |
load_text(filename) { | |
size = 1024; // declare buffer stream // | |
// read given filename // | |
fin = new BufferedReader (new InputStreamReader (new FileInputStream (filename)), size); | |
// assign empty string // | |
text = ""; line = "" ; | |
// when not reach the end on current line // | |
while((line = fin.readLine()) != null) | |
{ // return more one line again on data // | |
text += line; | |
// put at the end of line a new line // | |
text += "\n"; } | |
fin.close(); // close the file // | |
// return all data from filename // | |
return text ; | |
} // end of function | |
// output this current filename // | |
print ("Filename: " + getSourceFileInfo() + "\n"); | |
// output this current source // | |
print (load_text(getSourceFileInfo())); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment