Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners RandomAccessFile & FileInputStream
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Anand
RandomAccessFile & FileInputStream
1 Answer(s)      5 years and 6 months ago
Posted in : Java Beginners



Advertisement
View Answers

June 25, 2009 at 12:12 PM


Hi Friend,

Unlike the input and output streams java.io. RandomAccessFile is used for both reading and writing the files with the use of three modes 'r','rw','rwd','rws'. A random access file treats with a large array of bytes stored in the file system and uses the file pointer to deal with the index of that array. This file pointer points the positions in the file where the reading or writing operation has to be done.

For more information,please visit the following links:

http://www.roseindia.net/java/example/java/io/RandAccessFile.shtml
http://www.roseindia.net/java/example/java/io/java-read-file-line-by-line.shtml

Thanks



Related Tutorials/Questions & Answers:
RandomAccessFile & FileInputStream - Java Beginners
RandomAccessFile & FileInputStream  I included a piece of code for reading data from a file using FileInputStream and RandomAccessFile class... when compared to FileInputStream. Also RandomAccessFile can read multiple
java RandomAccessFile
java RandomAccessFile  What is the difference between the File and RandomAccessFile classes
Advertisements
getResourceAsStream() vs FileInputStream
getResourceAsStream() vs FileInputStream  getResourceAsStream() vs FileInputStream
Java RandomAccessFile Example
Java RandomAccessFile Example Here you will learn about the RandomAccessFile... between 2 and 10 into text file. Then using the RandomAccessFile, we have...(); } } bw.close(); RandomAccessFile randomFile=new RandomAccessFile(f,"rw"
Java FileInputStream
Java FileInputStream In this section we will discuss about the Java IO FileInputStream. FileInputStream is a class provided in the java.io package... of FileInputStream class. FileInputStream's object can be created using following its
FILEOUTPUTSTREAM and FILEINPUTSTREAM - Java Beginners
FILEOUTPUTSTREAM and FILEINPUTSTREAM  Using FILEOUTPUTSTREAM and FILEINPUTSTREAM provide code that will write bytes to file and read them back.   Hi Friend, Please visit the following links: http
how to write file from FileInputStream
from FileInputStream. Please feel free to suggest or any reference website. Thanks,   Hi, For Write to file from FileInputStream in java you may use the FileInputStream class of java.io package. Using this class takes input
Java FileInputStream Example
Reading a file using FileInputStream... FileInputStream Java has Two types of streams- Byte & Characters. For reading... is used to read data from a file. The FileInputStream is the subclass
Java Write To File From FileInputStream
Java Write To File From FileInputStream In this tutorial you will learn how to write to file from FileInputStream. Write to file from FileInputStream in java you may use the FileInputStream class of java.io package. This class takes
How to use random access file
of RandomAccessFile class. RandomAccessFile allows read and write operations to any... manner. Unlike other  input and output streams, RandomAccessFile.... If you want to perform read operation with RandomAccessFile, then you have
java help - Java Beginners
java help  Write the code for a method named getFile that accepts a file name and returns a file created from the RandomAccessFile class. This method...[])throws IOException { FileInputStream fis=null; try{ fis = new FileInputStream
About BufferedReader
About BufferedReader   I have created FileInputStream fstream = new FileInputStream("E:\\TE MODULE\\Main Workspace\\OS PHASE 1\\input.txt...; try{ FileInputStream fstream = new
How display a image on servlet from file upload - JSP-Servlet
. This exception will be thrown by the FileInputStream, FileOutputStream, and RandomAccessFile constructors when a file with the specified pathname does not exist
Java I\O file
Java I\O file  What is the difference between the File and RandomAccessFile classes
java - Java Beginners
java  public static void Trial(File file) { RandomAccessFile input = null; whats wrong in it? String line = null; try { input = new RandomAccessFile(file, "r"); while ((line
java io
java io  Write a program to use a File object and print even numbers from two to ten. Then using RandomAccessFile write numbers from 1 to 5. Then using seek () print only the last 3 digits
RANDOM ACCESS FILE CONCEPT
the RandomAccessFile class
RANDOM ACCESS FILE CONCEPT
RANDOM ACCESS FILE CONCEPT  Write a program to use a File object and print even numbers from two to ten. Then using RandomAccessFile write numbers from 1 to 5. Then using seek () print only the last 3 digits
Java file seek
is RandomAccessFile. This class has two arguments, one of which is a File object... created an object of RandomAccessFile class and pass file object and 'rw' mode... of RandomAccessFile writes the string into the file. Here is the code: import
Unhandled Exception in Thread
pathname or fails to open. This exception is thrown by the FileInputStream, FileOutputStream, and RandomAccessFile constructors
File Handling In Java
, FileInputStream, FileOutputStream, ByteArrayInputStream, ByteArrayOutputStream, PrintStream, RandomAccessfile etc. Methods defined by InputStream : read(), read(byte
RANDOM ACCESS FILE CONCEPT
RANDOM ACCESS FILE CONCEPT  Write a program to write the details of an employee to a file. Details such as year of joining, department code, employee name and salary should be included. You must use RandomAccessFile
SHA256 of a file
[]args)throws Exception{ int by = 16384; try { RandomAccessFile file = new RandomAccessFile("data.txt", "r"); MessageDigest md... { RandomAccessFile file = new RandomAccessFile("data.txt", "r"); MessageDigest
IOException - Java Beginners
("DemoRandomAccessFile.out"); RandomAccessFile raf = new RandomAccessFile(file, "rw...("DemoRandomAccessFile.out"); RandomAccessFile raf = new RandomAccessFile(file, "rw"); raf.seek
How display a image on servlet from file upload - JSP-Servlet
by the FileInputStream, FileOutputStream, and RandomAccessFile constructors when a file
File Handling - Java Beginners
{ File f; f= new File(name); if(f.exists()){ RandomAccessFile rand = new RandomAccessFile(name,"rw"); System.out.println
Java programming help with files - Java Beginners
")){ RandomAccessFile rand = new RandomAccessFile("American.txt","rw"); rand.writeBytes(data); rand.close(); } else{ RandomAccessFile rand = new RandomAccessFile("NonAmerican.txt","rw"); rand.writeBytes(data
Classes and Interfaces of the I/O Streams
.  FileDescriptor This class uses for create a FileInputStream and FileOutputStream.  FileInputStream It contains the input...;RandomAccessFile It supports both reading and writing to a random access file
JSP - Java Server Faces Questions
JSP  how to set a lock to the folder by using jsp?  Hi friend, Code to help in solving the problem. FileInputStream in = new FileInputStream(file) { try { java.nio.channels.FileLock lock
input output
input output  java program using fileinputstream and fileoutputstream   Hi Friend, Try the following code: import java.io.*; class...) throws Exception { FileInputStream in = new FileInputStream("c:/hello.txt
 

 

 

DMCA.com