Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/** * Opens and reads the contents of the dictionary file specified in fileName. The file is * assumed to be a text file encoded

/**

* Opens and reads the contents of the dictionary file specified in fileName. The file is

* assumed to be a text file encoded in UTF-8. It is assumed that there is one translation

* mapping per line. Each line contains a key and its translation separated by a tab.

* Note: The dictionary file is assumed to be sorted by the keys in ascending order.

*

* For each line in the dictionary file, an entry is added into wordList. The entry is a String

* array of length 2, where the value of index 0 is the key and the value of index 1 is the

* translation.

*

* When opening the file, any FileNotFoundException is caught and the error message

* "Exception: File 'fileName' not found." followed by a new line is output,

* where fileName is the name of the file that the method attempted to open.

*

* @param fileName

* @param wordList Reference to ArrayList to contain the translation mappings.

* @throws IOException if an I/O error occurs when closing the file. FileNotFoundException is

* caught when opening the file.

*/

public static void readDictFile(String fileName,

ArrayList wordList) throws IOException {

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions