Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password

Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.

File Input and Output

        Help!  

Term
Definition
Volatile Storage   show
🗑
Random Access Memory(RAM)   show
🗑
Nonvolatile Storage   show
🗑
Computer File   show
🗑
show Contain data that can be read in a text editor because the data has been encoded using a scheme such as ASCII or Unicode  
🗑
show Some text files are data files that contain facts and figures, such as a payroll file that contains employee numbers, names, and salaries  
🗑
Program or Application Files   show
🗑
show Contain data that has not bee encoded in text. Their contents are n binary format, which means that you cannot understand them by viewing them in a text editor  
🗑
Root Directory   show
🗑
Path   show
🗑
Path Delimiter   show
🗑
Path Class   show
🗑
Files Class   show
🗑
Path and Files Import Package   show
🗑
show First determine the default file system on the host computer by using a statement such as follows... FileSystem fs = FileSystems.getDefault();...This statement creates a FileSystem object using getDefault() method in FileSystems class.  
🗑
2. Creating a Path   show
🗑
show FileSystems, with an ending s, is a class that contains factory methods, which assist in object creation  
🗑
show Another way to create a Path is to use the Paths class. You can create a path object by using the following statement... Path filePath = Paths.get("C:\\Java\\Chapter.13\\SampleFile.txt");.  
🗑
2. Alternative Way to Create a Path   show
🗑
show Every Path is either absolute or relative. An absolute path is a complete path; it does not need any other information to locate a file on a system. Ex: C:\\Java\\Chapter.13\\SampleFile.txt  
🗑
Relative Path   show
🗑
1. Selected Path Class Methods   show
🗑
2. Selected Path Class Methods   show
🗑
show 3. Method[int getNameCount()]..Description[Returns the number of name elements in the Path]... 4. Method[Path getName(int)]..Description[Returns the name in the position of the Path specified by the integer parameter]  
🗑
show Converts a relative path to an absolute path  
🗑
1. checkAccess() Method   show
🗑
show Assuming that you have declared a Path named filePath, the syntax you use with checkAccess() is as follows... filePath.getFileSystem().provider().checkAccess();  
🗑
show 1. No argument - Checks that the file exists; you can substitute the Files.exists() method and pass it a Path argument... 2. READ - Checks that the file exist as and that the program has permission to read the file...  
🗑
show 3. WRITE - Checks that the file exists and that the program has permission to write to the file... 4. EXECUTE - Checks that the file exists and that the program has permission to execute the file  
🗑
1. Deleting a Path   show
🗑
2. Deleting a Path   show
🗑
show 3. If you try to delete a file but you don't have permission, a SecurityException is thrown... 4. Other input/output errors cause an IOException  
🗑
deleteIfExists() Method   show
🗑
show A Files class method that retrieves useful information about a file. Takes two arguments - a Path object and BasicFileAttributes.class - and return an instance of the BasicFileAttributes class.  
🗑
2. readAttributes() Method   show
🗑
BasicFileAttributes object Methods   show
🗑
FileTime Object Format   show
🗑
1. compareTo() Method   show
🗑
2. compareTo() Method   show
🗑
show Can be any letter, number, or other special symbol that makes up data. This is the smallest useful piece of data to most users. Characters are made up of bits(ones and zeros that represent computer circuitry)  
🗑
show A group of characters that has some meaning. Ex: The characters T, o, and m might represent you first name(Tom). Characters are grouped together into fields  
🗑
Record   show
🗑
show Data files consist or related records, such as a company's personnel file that contains one record for each company employee. Records are grouped to create files  
🗑
Sequential Access File   show
🗑
show A file in which each value in a record is separated from the next by a comma; CSV is a widely used format for files used in all sorts of applications, including databases and spreadsheets  
🗑
show You must open a file before the application can use it. A Java application opens a file by creating an object and associated a stream of bytes with it  
🗑
show When you finish using file, program should close it(make it not available). If you fail to close an input file(reading data from it) there are not serious consequences. If you fail to close an output file(writing data to it) data might become inaccessible  
🗑
show A stream is an object, and like all object, streams have data and methods. The methods allows you to perform actions such as opening, closing, reading, and writing.  
🗑
show When you perform input operations in an application, bytes flowing into your program from an input device through a stream, which functions as a pipeline or channel. Most streams flow in only one direction; each stream is either a input or output stream  
🗑
show A memory location where bytes are held after they are logically output but before they are sent to the output device. Using a buffer to accumulate input or output before issuing the actual IO command improves program performance  
🗑
show Clears any bytes that have been sent to a buffer for output but have not yet been output to a hardware device. When you use an output buffer, you sometimes flush it before closing it  
🗑
1. Classes Used for Input and Output   show
🗑
show 3. Class[BufferedInputStream]..Description[Child of FIlterInputStream, which is a child of InputStream; BufferedInputStream handles input from a system's standard input device, usually the keyboard]...  
🗑
show 4. Class[OutputStream]..Description[Abstract class that contains method for performing output]... 5. Class[FileOutputStream]..Description[Child of OutputStream that allows you to write to disk files]...  
🗑
show 6. Class[BufferedOuptutStrean]..Description[Child of FIlterOutputStream, which is a child of OuptuStream; BufferedOutputStream handles input from a system's standarad output device, usually the monitor]...  
🗑
show 7. Class[PrintStream]..Description[Child of FilterOutputStream, which is child of OutputStream; System.out is a PrintStream object]...  
🗑
show 8. Class[Reader]..Description[Abstract class for reading character streams; the only methods that a subclass must implement are rea(char[], int, int) and close()]...  
🗑
7. Classes Used for Input and Output   show
🗑
show 10. Class[BufferedWriter]..Description[Writes text to a character-output stream, buffering characters to provide for the efficient writing of characters, arrays, and lines]  
🗑
show 1. Method[void close()]..Description[Closes the output stream and releases any system resources associated with the stream]...  
🗑
2. OutputStream Methods   show
🗑
show 4. Method[void write(byte[] b, int off, int len)]..Description[Writes bytes to the output stream from the specified byte array starting at offset position off for a length of len characters]  
🗑
1. newOutputStream() Method   show
🗑
2. newOutputStream() Method   show
🗑
show 1. Constant[WRITE]..Description[Opens the file for writing]... 2. Constant[APPEND]..Description[Appends new data to the end of the file; using this option with WRITE or CREATE]...  
🗑
2. StandardOpenOption Constants   show
🗑
3. StandardOpenOption Constants   show
🗑
4. StandardOpenOption Constants   show
🗑
show To open a file for reading, you can use the Files class newInputStream() method. Accepts a Path parameter and return a stream that can read bytes from a file  
🗑
1. BufferedReader Methods   show
🗑
show 3. Method[read(char[] buffer, int off, int len)]..Description[Reads character into a portion of an array from position off for len characters]... 4. Method[readLine()]..Description[Reads a line of text]...  
🗑
3. BufferedReader Methods   show
🗑
1. BufferedWriter Method   show
🗑
2. BufferedWriter Method   show
🗑
show 6. Method[write(int c)]..Description[Writes a single character]  
🗑
String Class split() Method   show
🗑
show Involves performing the same tasks with many records, one after the other  
🗑
show For many applications, sequential access is inefficient. These applications, known as real-time applications, require that a record be accessed immediately while a client is waiting  
🗑
Interactive Program   show
🗑
show Files in which records can be retrieved directly in any order. Random files are also called direct access files and instant access files  
🗑
show A file channel object is an avenue for reading and writing a file. You can use Java's FileChannel class to create your own random access files  
🗑
show A file channel is seekable, meaning you can search for a specific file location and operations can start at any specified position  
🗑
show 1. Method[FileChannel open(Path file, OpenOption...options)]..Description[Opens or creates a file, returning a file channel to access the file]...  
🗑
show 2. Method[long position()]..Description[Returns the channel's file position]... 3. Method[FileChannel position(long newPosition)]..Description[Sets the channel's file position]...  
🗑
show 4. Method[int read(ByteBuffer buffer)]..Description[Reads a sequence of bytes from the channel into the buffer]... 5. Method[long size()]..Description[Returns the size of the channel's size]...  
🗑
4. FileChanel Methods   show
🗑
show Is simply a holding place for bytes waiting to be read or written.  
🗑
ByteBuffer wrap() Method   show
🗑
Key Field   show
🗑


   

Review the information in the table. When you are ready to quiz yourself you can hide individual columns or the entire table. Then you can click on the empty cells to reveal the answer. Try to recall what will be displayed before clicking the empty cell.
 
To hide a column, click on the column name.
 
To hide the entire table, click on the "Hide All" button.
 
You may also shuffle the rows of the table by clicking on the "Shuffle" button.
 
Or sort by any of the columns using the down arrow next to any column heading.
If you know all the data on any row, you can temporarily remove it by tapping the trash can to the right of the row.

 
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how
Popular Engineering sets