RandomAccessFileDataSource.java revision 9883:903a2e023ffb
1184610Salfred/*
2184610Salfred * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
3184610Salfred * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4184610Salfred *
5184610Salfred * This code is free software; you can redistribute it and/or modify it
6184610Salfred * under the terms of the GNU General Public License version 2 only, as
7184610Salfred * published by the Free Software Foundation.
8184610Salfred *
9184610Salfred * This code is distributed in the hope that it will be useful, but WITHOUT
10184610Salfred * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11184610Salfred * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12184610Salfred * version 2 for more details (a copy is included in the LICENSE file that
13184610Salfred * accompanied this code).
14184610Salfred *
15184610Salfred * You should have received a copy of the GNU General Public License version
16184610Salfred * 2 along with this work; if not, write to the Free Software Foundation,
17184610Salfred * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18184610Salfred *
19184610Salfred * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20184610Salfred * or visit www.oracle.com if you need additional information or have any
21184610Salfred * questions.
22184610Salfred *
23184610Salfred */
24184610Salfred
25184610Salfredpackage sun.jvm.hotspot.debugger;
26184610Salfred
27194230Sthompsaimport java.io.*;
28194230Sthompsa
29184610Salfred/* This class is used by the Windows COFF and Posix ELF implementations. */
30246122Shselaskypublic class RandomAccessFileDataSource implements DataSource {
31217350Sjhb  public RandomAccessFileDataSource(RandomAccessFile file) {
32184610Salfred    this.file = file;
33217350Sjhb  }
34246122Shselasky
35184610Salfred  public byte  readByte()       throws IOException { return file.readByte();       }
36184610Salfred  public short readShort()      throws IOException { return file.readShort();      }
37286773Shselasky  public int   readInt()        throws IOException { return file.readInt();        }
38217350Sjhb  public long  readLong()       throws IOException { return file.readLong();       }
39217350Sjhb  public int   read(byte[] b)   throws IOException { return file.read(b);          }
40184610Salfred  public void  seek(long pos)   throws IOException { file.seek(pos);               }
41184610Salfred  public long  getFilePointer() throws IOException { return file.getFilePointer(); }
42184610Salfred  public void  close()          throws IOException { file.close();                 }
43184610Salfred
44184610Salfred  private RandomAccessFile file;
45184610Salfred}
46184610Salfred