Skip to content

Instantly share code, notes, and snippets.

@marcoonroad
Created January 28, 2014 03:34
Show Gist options
  • Save marcoonroad/8661871 to your computer and use it in GitHub Desktop.
Save marcoonroad/8661871 to your computer and use it in GitHub Desktop.
Um simples BeanShell script que "printa" o própio source code.
// 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