'void seek(long position) throws IOException' Sets the current position within the file, in bytes. : RandomAccessFile « File « SCJP

Home
SCJP
1.Java Source And Data Type
2.Operators
3.Modifiers
4.Type Casting
5.Statements
6.Object Oriented
7.Thread
8.Utility Classes
9.File
SCJP » File » RandomAccessFile 
9.2.5.'void seek(long position) throws IOException' Sets the current position within the file, in bytes.
import java.io.File;
import java.io.RandomAccessFile;
public class MainClass{
    public static void main(String[] argvthrows Exception{
         File file = new File("test.dat");
        
         RandomAccessFile raf = new RandomAccessFile(file, "rw");
        
         raf.seek(10);

    }
}
9.2.RandomAccessFile
9.2.1.Create RandomAccessFile from File object
9.2.2.A RandomAccessFile has a file pointer
9.2.3.'long getFilePointer() throws IOException' returns the current position within the file in bytes.
9.2.4.'long length()' throws IOException Returns the length of the file, in bytes.
9.2.5.'void seek(long position) throws IOException' Sets the current position within the file, in bytes.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.