Yes I have an example file of abbreviations and the message that uses these abbreviations
package abbreviationstest;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.util.Scanner;
import java.io.FileNotFoundException;
/**
*
* @author 420
*/
public class abbreviationsTest
{
public static void main(String[] args)
{
String fileName = "abbreviations.txt";
Scanner inputStream = null;
System.out.println("The file " + fileName + " contains the following lines:");
try
{
inputStream = new Scanner(new File(fileName));
//messageInputStream = new Scanner(new File(fileName));
}
catch(FileNotFoundException e)
{
System.out.println("Error opening the file " + fileName);
}
while (inputStream.hasNextLine())
{
String line = inputStream.nextLine();
System.out.println(line);
}
inputStream.close();
String message = "message.txt";
//FileOutputStream// messageOutputStream =
try
{
FileOutputStream outputStream = new FileOutputStream(new String(message));
System.out.println("The file " + message + " contains the following lines:");
Scanner keyboard = new Scanner(new File(message));
String newMessage = message;
do
{
newMessage = keyboard.next();
outputStream.toString();
}
while(newMessage.matches(message));
{
System.out.print(newMessage);
}
}
catch(FileNotFoundException e1)
{
System.out.println("Error opening the file " + message);
}
}
}