mri.fortune
Class Fortune
java.lang.Object
|
+--mri.fortune.Fortune
- All Implemented Interfaces:
- java.lang.Runnable
- public class Fortune
- extends java.lang.Object
- implements java.lang.Runnable
JFortune - Java port of Berkeley fortune.c
print a random, hopefully interesting, adage
Usage :
Fortune fortune = new Fortune();
fortune.init([file]);
String s = fortune.getFortune();
fortune.close();
- Version:
- $Revision: 1.1$
- Author:
- M Riess
- See Also:
StrFile
Method Summary |
void |
close()
|
void |
finalize()
|
java.lang.String |
getFortune()
|
void |
init(java.lang.String fname)
Ouverture du fichier |
void |
load(java.lang.String fname)
Chargement d'un adage au hasard |
static void |
main(java.lang.String[] args)
fortune [-w] [file|dir]
StrFile reads a file containing groups of lines separated by a line containing a single percent `%' sign (or
other specified delimiter character) and creates a data file which contains a header structure and a table of
file offsets for each group of lines. |
void |
run()
|
void |
setCR(java.lang.String cr)
|
void |
setFileName(java.lang.String fname)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Fortune
public Fortune()
main
public static void main(java.lang.String[] args)
- fortune [-w] [file|dir]
StrFile reads a file containing groups of lines separated by a line containing a single percent `%' sign (or
other specified delimiter character) and creates a data file which contains a header structure and a table of
file offsets for each group of lines. This allows random access of the strings.
- Parameters:
-w
- Wait before termination for an amount of time calculated from the number of characters in the message.file
- source of fortunes
run
public void run()
- Specified by:
run
in interface java.lang.Runnable
init
public void init(java.lang.String fname)
- Ouverture du fichier
load
public void load(java.lang.String fname)
- Chargement d'un adage au hasard
- See Also:
Random.nextInt()
setCR
public void setCR(java.lang.String cr)
setFileName
public void setFileName(java.lang.String fname)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
getFortune
public java.lang.String getFortune()
close
public void close()
finalize
public void finalize()
throws java.lang.Throwable
- Overrides:
finalize
in class java.lang.Object