OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.lang/] [LargeFile.java] - Blame information for rev 767

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 765 jeremybenn
/* Test to ensure files >= 2^31 bytes are supported. */
2
 
3
import java.io.*;
4
 
5
public class LargeFile
6
{
7
  public static void main(String[] args) throws IOException
8
  {
9
    File file = new File("LargeFile.tmp");
10
 
11
    try
12
      {
13
        RandomAccessFile rfile = new RandomAccessFile(file, "rw");
14
 
15
        long pos = (long) Math.pow(2, 31);
16
 
17
        rfile.seek(pos);
18
        rfile.write('O');
19
        rfile.write('K');
20
        rfile.close();
21
 
22
        // Re-open, read byte back using FileInputStream and clean up.
23
 
24
        FileInputStream fis = new FileInputStream(file);
25
        fis.skip(pos);
26
        System.out.print((char) fis.read());
27
        System.out.println((char) fis.read());
28
        fis.close();
29
      }
30
    finally
31
      {
32
        if (file.exists())
33
          file.delete();
34
      }
35
  }
36
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.