RandomAccessFile Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Instances of this class support both reading and writing to a random access file.
[Android.Runtime.Register("java/io/RandomAccessFile", DoNotGenerateAcw=true)]
public class RandomAccessFile : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.IO.ICloseable, Java.IO.IDataInput, Java.IO.IDataOutput
[<Android.Runtime.Register("java/io/RandomAccessFile", DoNotGenerateAcw=true)>]
type RandomAccessFile = class
inherit Object
interface ICloseable
interface IJavaObject
interface IDisposable
interface IJavaPeerable
interface IDataInput
interface IDataOutput
- Inheritance
- Attributes
- Implements
Remarks
Instances of this class support both reading and writing to a random access file. A random access file behaves like a large array of bytes stored in the file system. There is a kind of cursor, or index into the implied array, called the <em>file pointer</em>; input operations read bytes starting at the file pointer and advance the file pointer past the bytes read. If the random access file is created in read/write mode, then output operations are also available; output operations write bytes starting at the file pointer and advance the file pointer past the bytes written. Output operations that write past the current end of the implied array cause the array to be extended. The file pointer can be read by the getFilePointer
method and set by the seek
method.
It is generally true of all the reading routines in this class that if end-of-file is reached before the desired number of bytes has been read, an EOFException
(which is a kind of IOException
) is thrown. If any byte cannot be read for any reason other than end-of-file, an IOException
other than EOFException
is thrown. In particular, an IOException
may be thrown if the stream has been closed.
Added in JDK1.0.
Java documentation for java.io.RandomAccessFile
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Constructors
RandomAccessFile(File, String) |
Creates a random access file stream to read from, and optionally to
write to, the file specified by the |
RandomAccessFile(IntPtr, JniHandleOwnership) |
A constructor used when creating managed representations of JNI objects; called by the runtime. |
RandomAccessFile(String, String) |
Creates a random access file stream to read from, and optionally to write to, a file with the specified name. |
Properties
Channel |
Returns the unique |
Class |
Returns the runtime class of this |
FD |
Returns the opaque file descriptor object associated with this stream. |
FilePointer |
Returns the current offset in this file. |
Handle |
The handle to the underlying Android instance. (Inherited from Object) |
JniIdentityHashCode | (Inherited from Object) |
JniPeerMembers | |
PeerReference | (Inherited from Object) |
ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. |
ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. |
Methods
Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
Close() |
Closes this random access file stream and releases any system resources associated with the stream. |
Dispose() | (Inherited from Object) |
Dispose(Boolean) | (Inherited from Object) |
Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
Length() |
Returns the length of this file. |
Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
Read() |
Reads a byte of data from this file. |
Read(Byte[], Int32, Int32) |
Reads up to |
Read(Byte[]) |
Reads up to |
ReadAsync() | |
ReadAsync(Byte[], Int32, Int32) | |
ReadAsync(Byte[]) | |
ReadBoolean() |
Reads a |
ReadBooleanAsync() | |
ReadByte() |
Reads a signed eight-bit value from this file. |
ReadByteAsync() | |
ReadChar() |
Reads a character from this file. |
ReadCharAsync() | |
ReadDouble() |
Reads a |
ReadDoubleAsync() | |
ReadFloat() |
Reads a |
ReadFloatAsync() | |
ReadFully(Byte[], Int32, Int32) |
Reads exactly |
ReadFully(Byte[]) |
Reads |
ReadFullyAsync(Byte[], Int32, Int32) | |
ReadFullyAsync(Byte[]) | |
ReadInt() |
Reads a signed 32-bit integer from this file. |
ReadIntAsync() | |
ReadLine() |
Reads the next line of text from this file. |
ReadLineAsync() | |
ReadLong() |
Reads a signed 64-bit integer from this file. |
ReadLongAsync() | |
ReadShort() |
Reads a signed 16-bit number from this file. |
ReadShortAsync() | |
ReadUnsignedByte() |
Reads an unsigned eight-bit number from this file. |
ReadUnsignedByteAsync() | |
ReadUnsignedShort() |
Reads an unsigned 16-bit number from this file. |
ReadUnsignedShortAsync() | |
ReadUTF() |
Reads in a string from this file. |
ReadUTFAsync() | |
Seek(Int64) |
Sets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs. |
SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
SetLength(Int64) |
Sets the length of this file. |
SkipBytes(Int32) |
Attempts to skip over |
SkipBytesAsync(Int32) | |
ToArray<T>() | (Inherited from Object) |
ToString() |
Returns a string representation of the object. (Inherited from Object) |
UnregisterFromRuntime() | (Inherited from Object) |
Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Write(Byte[], Int32, Int32) |
Writes |
Write(Byte[]) |
Writes |
Write(Int32) |
Writes the specified byte to this file. |
WriteAsync(Byte[], Int32, Int32) | |
WriteAsync(Byte[]) | |
WriteAsync(Int32) | |
WriteBoolean(Boolean) |
Writes a |
WriteBooleanAsync(Boolean) | |
WriteByte(Int32) |
Writes a |
WriteByteAsync(Int32) | |
WriteBytes(String) |
Writes the string to the file as a sequence of bytes. |
WriteBytesAsync(String) | |
WriteChar(Int32) |
Writes a |
WriteCharAsync(Int32) | |
WriteChars(String) |
Writes a string to the file as a sequence of characters. |
WriteCharsAsync(String) | |
WriteDouble(Double) |
Converts the double argument to a |
WriteDoubleAsync(Double) | |
WriteFloat(Single) |
Converts the float argument to an |
WriteFloatAsync(Single) | |
WriteInt(Int32) |
Writes an |
WriteIntAsync(Int32) | |
WriteLong(Int64) |
Writes a |
WriteLongAsync(Int64) | |
WriteShort(Int32) |
Writes a |
WriteShortAsync(Int32) | |
WriteUTF(String) |
Writes a string to the file using modified UTF-8 encoding in a machine-independent manner. |
WriteUTFAsync(String) |
Explicit Interface Implementations
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |