// // EncapsulatedRandomAccessFile class // part of the set of documents known as Java no sugar. // Copyright (c) 1996 Sunil Gupta, sunil@magnetic.demon.co.uk // placed into the public domain by the author // // Unfortunately RandomAccessFile has loads of final methods, which means // that if you want to change behaviours of subclasses (eg byte swapping) // it cant be done in a transparent fashion. This is inheritance by the backdoor // and appears to create a subclasses by encapsulation and changes final // methods to ordinary ones // ****************************************************************************** // import java.io.*; public class EncapsulatedRandomAccessFile extends Object { private RandomAccessFile file; // Constructors public EncapsulatedRandomAccessFile(File infile, String mode) throws IOException { file = new RandomAccessFile(infile, mode);} public EncapsulatedRandomAccessFile(String name, String mode) throws IOException { file = new RandomAccessFile(name, mode);} // Methods public void close() throws IOException {file.close(); } public FileDescriptor getFD() throws IOException {return file.getFD(); } public long getFilePointer() throws IOException {return file.getFilePointer(); } public long length() throws IOException {return file.length(); } public int read() throws IOException {return file.read(); } public int read(byte b[]) throws IOException {return file.read(b); } public int read(byte b[], int off, int len) throws IOException {return file.read(b,off,len); } public boolean readBoolean() throws IOException {return file.readBoolean(); } public byte readByte() throws IOException {return file.readByte(); } public char readChar() throws IOException {return file.readChar(); } public double readDouble() throws IOException {return file.readDouble(); } public float readFloat() throws IOException {return file.readFloat(); } public void readFully(byte b[]) throws IOException {file.readFully(b); } public void readFully(byte b[], int off, int len)throws IOException {file.readFully(b,off,len); } public int readInt() throws IOException {return file.readInt(); } public String readLine() throws IOException {return file.readLine(); } public long readLong() throws IOException {return file.readLong(); } public short readShort() throws IOException {return file.readShort(); } public int readUnsignedByte() throws IOException {return file.readUnsignedByte(); } public int readUnsignedShort() throws IOException {return file.readUnsignedShort();} public String readUTF() throws IOException {return file.readUTF(); } public void seek(long pos) throws IOException {file.seek(pos); } public int skipBytes(int n) throws IOException {return file.skipBytes(n); } public void write(byte b[]) throws IOException {file.write(b); } public void write(byte b[], int off, int len) throws IOException {file.write(b,off,len); } public void write(int b) throws IOException {file.write(b); } public void writeBoolean(boolean v) throws IOException {file.writeBoolean(v); } public void writeByte(int v) throws IOException {file.writeByte(v); } public void writeBytes(String s) throws IOException {file.writeBytes(s); } public void writeChar(int v) throws IOException {file.writeChar(v); } public void writeChars(String s) throws IOException {file.writeChars(s); } public void writeDouble(double v) throws IOException {file.writeDouble(v); } public void writeFloat(float v) throws IOException {file.writeFloat(v); } public void writeInt(int v) throws IOException {file.writeInt(v); } public void writeLong(long v) throws IOException {file.writeLong(v); } public void writeShort(int v) throws IOException {file.writeShort(v); } public void writeUTF(String str) throws IOException {file.writeUTF(str); } }
file: /Techref/language/JAVA/nosugar/comms/code/EncapsulatedRandomAccessFile.java, 4KB, , updated: 1996/10/16 00:46, local time: 2024/12/28 23:50,
13.58.221.124:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://sxlist.com/techref/language/JAVA/nosugar/comms/code/EncapsulatedRandomAccessFile.java"> language JAVA nosugar comms code EncapsulatedRandomAccessFile</A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.