RandomAccessFile

class RandomAccessFile(file: File, arg0: String)(implicit converter: ByteConverter) extends DataInput with DataOutput with Closeable

Wrapper for java.io.RandomAccessFile.

The main differences to java.io.RandomAccessFile are (1) naming (e.g. default naming is readInt64 instead of readLong) (2) the readXXX(n: Int) functions, which will try to read n samples from the file. (Try to use these functions instead of reading multiple times in a loop with readXXX(), as each individual read is costly in terms of performance. * Each function throws a java.io.IOException (including subclass java.io.EOFException). These can be caught in Scala if necessary, to detect ends of files when reading, for example. Catching is obligatory in Java.

Type Java Type Scala Type Value Range
Int8: Signed 8-bit integer byte Byte [-128, 127]
UInt8: Unsigned 8-bit integer (int) (Int) [0, 255]
Int16: Signed 16-bit integer short Short [-32768, 32767]
UInt16: Unsigned 16-bit integer char Char [0, 65535]
Int32: Signed 32-bit integer int Int [-2147483648, 2147483647]
UInt32: Unsigned 32-bit integer (long) (Long) [0, 4294967295]
Int64: Signed 64-bit integer long Long [-9223372036854775808, 9223372036854775807]
UInt64: Unsigned 64-bit integer* (spire.math.Ulong) (spire.math.ULong) [0, 18446744073709551615]
UInt64Shifted: Unsigned 64-bit integer, shifted to signed range* (long)* (Long)* [0, 18446744073709551615*]

*note: given that the JVM/Scala does not have a UInt64 type, nor a Int128 to promote to, UInt64s are dealt with in two ways... (1) as a spire.math.ULong (which represents UInt64 wrapped as a regular Long where the negative values represent their unsigned two's complement equivalent:

Unsigned ULong value Internal Long (signed) wrapped by ULong
0 0
2^63-1 2^63-1
2^63 -2^63
2^64-1 -1

or (2) as a shifted Int64, where UInt64 is shifted down by 2^63 in its range to cover both positive and negative values of Int64 (this is compatible with + and -, for use as timestamps, for example, but is of course not compatible with * and / operations)

*implementation note: this class was not overriden from java.io.RandomAccessFile or implicitly "pimped," but instead passes through to java.io.RandomAccessFile. This is mainly because the java.io.RandomAccessFile.readXXX functions are declared final, and cannot be overridden.

trait Closeable
trait AutoCloseable
trait DataOutput
trait DataInput
class Object
trait Matchable
class Any

Value members

Constructors

def this(filename: String, arg0: String)(implicit converter: ByteConverter)

Concrete methods

@throws(scala.Predef.classOf[java.io.IOException])
final def WriteChar(value: Array[Char]): Unit

Alias, in java style, for breeze.io.RandomAccessFile.writeUInt16

Alias, in java style, for breeze.io.RandomAccessFile.writeUInt16

def close: Unit

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

def getChannel: FileChannel

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

def getFD: FileDescriptor

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

def jumpBytes(n: Int): Unit

like skipBytes but just jumps, does not return. For speed

like skipBytes but just jumps, does not return. For speed

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

final override def readBoolean(): Boolean

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

Definition Classes
DataInput
@throws(scala.Predef.classOf[java.io.IOException])
final override def readByte(): Byte

Alias, in java style, for breeze.io.RandomAccessFile.readInt8

Alias, in java style, for breeze.io.RandomAccessFile.readInt8

Definition Classes
DataInput
@throws(scala.Predef.classOf[java.io.IOException])
final def readByte(n: Int): Array[Byte]

Alias, in java style, for breeze.io.RandomAccessFile.readInt8

Alias, in java style, for breeze.io.RandomAccessFile.readInt8

@throws(scala.Predef.classOf[java.io.IOException])
final override def readChar(): Char

Alias, in java style, for breeze.io.RandomAccessFile.readUInt16

Alias, in java style, for breeze.io.RandomAccessFile.readUInt16

Definition Classes
DataInput
@throws(scala.Predef.classOf[java.io.IOException])
final def readChar(n: Int): Array[Char]

Alias, in java style, for breeze.io.RandomAccessFile.readUInt16

Alias, in java style, for breeze.io.RandomAccessFile.readUInt16

@throws(scala.Predef.classOf[java.io.IOException])
override def readDouble(): Double

Tries to read a Double at the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to read a Double at the current getFilePointer(). Will throw an exception if it encounters an end of file.

Definition Classes
DataInput
@throws(scala.Predef.classOf[java.io.IOException])
final def readDouble(n: Int): Array[Double]

Tries to read n Doubles from the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to read n Doubles from the current getFilePointer(). Will throw an exception if it encounters an end of file.

@throws(scala.Predef.classOf[java.io.IOException])
override def readFloat(): Float

Tries to read a Float at the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to read a Float at the current getFilePointer(). Will throw an exception if it encounters an end of file.

Definition Classes
DataInput
@throws(scala.Predef.classOf[java.io.IOException])
final def readFloat(n: Int): Array[Float]

Tries to read n Floats from the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to read n Floats from the current getFilePointer(). Will throw an exception if it encounters an end of file.

override def readFully(b: Array[Byte]): Unit

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

Definition Classes
DataInput
override def readFully(b: Array[Byte], off: Int, len: Int): Unit

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

Definition Classes
DataInput
@throws(scala.Predef.classOf[java.io.IOException])
final override def readInt(): Int

Alias, in java style, for breeze.io.RandomAccessFile.readUInt32

Alias, in java style, for breeze.io.RandomAccessFile.readUInt32

Definition Classes
DataInput
@throws(scala.Predef.classOf[java.io.IOException])
final def readInt(n: Int): Array[Int]

Alias, in java style, for breeze.io.RandomAccessFile.readUInt32

Alias, in java style, for breeze.io.RandomAccessFile.readUInt32

@throws(scala.Predef.classOf[java.io.IOException])

Tries to read an Int16 at the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to read an Int16 at the current getFilePointer(). Will throw an exception if it encounters an end of file.

@throws(scala.Predef.classOf[java.io.IOException])
final def readInt16(n: Int): Array[Short]

Tries to read n Int16s from the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to read n Int16s from the current getFilePointer(). Will throw an exception if it encounters an end of file.

@throws(scala.Predef.classOf[java.io.IOException])
final def readInt32(): Int

Tries to read an Int32 at the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to read an Int32 at the current getFilePointer(). Will throw an exception if it encounters an end of file.

@throws(scala.Predef.classOf[java.io.IOException])
final def readInt32(n: Int): Array[Int]

Tries to read n Int32s from the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to read n Int32s from the current getFilePointer(). Will throw an exception if it encounters an end of file.

@throws(scala.Predef.classOf[java.io.IOException])

Tries to read an Int64 at the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to read an Int64 at the current getFilePointer(). Will throw an exception if it encounters an end of file.

@throws(scala.Predef.classOf[java.io.IOException])
final def readInt64(n: Int): Array[Long]

Tries to read n Int64s from the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to read n Int64s from the current getFilePointer(). Will throw an exception if it encounters an end of file.

@throws(scala.Predef.classOf[java.io.IOException])
final def readInt8(): Byte

Tries to read an Int8 (Byte) at the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to read an Int8 (Byte) at the current getFilePointer(). Will throw an exception if it encounters an end of file.

@throws(scala.Predef.classOf[java.io.IOException])
final def readInt8(n: Int): Array[Byte]

Tries to read n Int8s (Bytes) from the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to read n Int8s (Bytes) from the current getFilePointer(). Will throw an exception if it encounters an end of file.

override def readLine(): String

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

Definition Classes
DataInput
@throws(scala.Predef.classOf[java.io.IOException])
final override def readLong(): Long

Alias, in java style, for breeze.io.RandomAccessFile.readInt64

Alias, in java style, for breeze.io.RandomAccessFile.readInt64

Definition Classes
DataInput
@throws(scala.Predef.classOf[java.io.IOException])
final def readLong(n: Int): Array[Long]

Alias, in java style, for breeze.io.RandomAccessFile.readInt64

Alias, in java style, for breeze.io.RandomAccessFile.readInt64

@throws(scala.Predef.classOf[java.io.IOException])
final override def readShort(): Short

Alias, in java style, for breeze.io.RandomAccessFile.readInt16

Alias, in java style, for breeze.io.RandomAccessFile.readInt16

Definition Classes
DataInput
@throws(scala.Predef.classOf[java.io.IOException])
final def readShort(n: Int): Array[Short]

Alias, in java style, for breeze.io.RandomAccessFile.readInt16

Alias, in java style, for breeze.io.RandomAccessFile.readInt16

@throws(scala.Predef.classOf[java.io.IOException])

Tries to read a UInt16 (Char) at the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to read a UInt16 (Char) at the current getFilePointer(). Will throw an exception if it encounters an end of file.

@throws(scala.Predef.classOf[java.io.IOException])
final def readUInt16(n: Int): Array[Char]

Tries to read n UInt16s (Chars) from the current getFilePointer() as Int32. Will throw an exception if it encounters an end of file.

Tries to read n UInt16s (Chars) from the current getFilePointer() as Int32. Will throw an exception if it encounters an end of file.

@throws(scala.Predef.classOf[java.io.IOException])
final def readUInt32(): Long

Tries to read a UInt32 as Long at the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to read a UInt32 as Long at the current getFilePointer(). Will throw an exception if it encounters an end of file.

@throws(scala.Predef.classOf[java.io.IOException])
final def readUInt32(n: Int): Array[Long]

Tries to read n UInt32s as Longs from the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to read n UInt32s as Longs from the current getFilePointer(). Will throw an exception if it encounters an end of file.

@throws(scala.Predef.classOf[java.io.IOException])
final def readUInt64(): ULong

Tries to read a UInt64 as spire.math.ULong at the current getFilePointer(). Will throw an exception for UInt64 values which are larger than the maximum Long. Will throw an exception if it encounters an end of file.

Tries to read a UInt64 as spire.math.ULong at the current getFilePointer(). Will throw an exception for UInt64 values which are larger than the maximum Long. Will throw an exception if it encounters an end of file.

@throws(scala.Predef.classOf[java.io.IOException])
final def readUInt64(n: Int): Array[ULong]

Tries to read n UInt64s from the current getFilePointer(). Will throw an exception for UInt64 values which are larger than the maximum Long. Will throw an exception if it encounters an end of file.

Tries to read n UInt64s from the current getFilePointer(). Will throw an exception for UInt64 values which are larger than the maximum Long. Will throw an exception if it encounters an end of file.

@throws(scala.Predef.classOf[java.io.IOException])
final def readUInt64Shifted(): Long

Tries to read a UInt64, shifted down in value to fit into Int64/Long at the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to read a UInt64, shifted down in value to fit into Int64/Long at the current getFilePointer(). Will throw an exception if it encounters an end of file.

@throws(scala.Predef.classOf[java.io.IOException])

Tries to read n UInt64s, shifted down in value to fit into Int64/Longs from the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to read n UInt64s, shifted down in value to fit into Int64/Longs from the current getFilePointer(). Will throw an exception if it encounters an end of file.

@throws(scala.Predef.classOf[java.io.IOException])
final def readUInt8(): Int

Tries to read a UInt8 as an Int16 at the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to read a UInt8 as an Int16 at the current getFilePointer(). Will throw an exception if it encounters an end of file.

@throws(scala.Predef.classOf[java.io.IOException])
final def readUInt8(n: Int): Array[Short]

Tries to read n UInt8s as Int from the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to read n UInt8s as Int from the current getFilePointer(). Will throw an exception if it encounters an end of file.

override def readUTF(): String

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

Definition Classes
DataInput
@throws(scala.Predef.classOf[java.io.IOException])
final override def readUnsignedByte(): Int

Alias, in java style, for breeze.io.RandomAccessFile.readUInt8

Alias, in java style, for breeze.io.RandomAccessFile.readUInt8

Definition Classes
DataInput
@throws(scala.Predef.classOf[java.io.IOException])

Alias, in java style, for breeze.io.RandomAccessFile.readUInt8

Alias, in java style, for breeze.io.RandomAccessFile.readUInt8

@throws(scala.Predef.classOf[java.io.IOException])
final override def readUnsignedShort(): Int

Alias, in java style, for breeze.io.RandomAccessFile.readUInt16, but reads as Int.

Alias, in java style, for breeze.io.RandomAccessFile.readUInt16, but reads as Int.

Definition Classes
DataInput
@throws(scala.Predef.classOf[java.io.IOException])
final def readUnsignedShort(n: Int): Array[Int]

Alias, in java style, for breeze.io.RandomAccessFile.readUInt16, but reads as Int.

Alias, in java style, for breeze.io.RandomAccessFile.readUInt16, but reads as Int.

def seek(pos: Long): Unit

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

def setLength(newLength: Long): Unit

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

override def skipBytes(n: Int): Int

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

Definition Classes
DataInput
@throws(scala.Predef.classOf[java.io.IOException])
final def write(v: Byte): Unit

Alias, in java style, for breeze.io.RandomAccessFile.writeInt8

Alias, in java style, for breeze.io.RandomAccessFile.writeInt8

@throws(scala.Predef.classOf[java.io.IOException])
final def write(v: Array[Byte]): Unit

Alias, in java style, for breeze.io.RandomAccessFile.writeInt8

Alias, in java style, for breeze.io.RandomAccessFile.writeInt8

def write(b: Int): Unit

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

def write(b: Array[Byte], off: Int, len: Int): Unit

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

def writeByte(v: Int): Unit

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

@throws(scala.Predef.classOf[java.io.IOException])
final def writeChar(value: Char): Unit

Alias, in java style, for breeze.io.RandomAccessFile.writeUInt16

Alias, in java style, for breeze.io.RandomAccessFile.writeUInt16

@throws(scala.Predef.classOf[java.io.IOException])
final override def writeChar(v: Int): Unit

Alias, in java style, for breeze.io.RandomAccessFile.writeUInt16

Alias, in java style, for breeze.io.RandomAccessFile.writeUInt16

Definition Classes
DataOutput
final override def writeChars(value: String): Unit

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

Definition Classes
DataOutput
@throws(scala.Predef.classOf[java.io.IOException])
@throws(scala.Predef.classOf[java.io.IOException])
@throws(scala.Predef.classOf[java.io.IOException])
@throws(scala.Predef.classOf[java.io.IOException])
@throws(scala.Predef.classOf[java.io.IOException])
final def writeInt(value: Int): Unit

Alias, in java style, for breeze.io.RandomAccessFile.writeInt32

Alias, in java style, for breeze.io.RandomAccessFile.writeInt32

@throws(scala.Predef.classOf[java.io.IOException])
final def writeInt(value: Array[Int]): Unit

Alias, in java style, for breeze.io.RandomAccessFile.writeInt32

Alias, in java style, for breeze.io.RandomAccessFile.writeInt32

@throws(scala.Predef.classOf[java.io.IOException])
final def writeInt16(v: Short): Unit

Tries to write an Int16 (Short) to the current getFilePointer().

Tries to write an Int16 (Short) to the current getFilePointer().

@throws(scala.Predef.classOf[java.io.IOException])
final def writeInt16(v: Array[Short]): Unit

Tries to write an array of Int16s (Shorts) to the current getFilePointer().

Tries to write an array of Int16s (Shorts) to the current getFilePointer().

@throws(scala.Predef.classOf[java.io.IOException])
final def writeInt32(v: Int): Unit

Tries to write an Int32 (Int) to the current getFilePointer().

Tries to write an Int32 (Int) to the current getFilePointer().

@throws(scala.Predef.classOf[java.io.IOException])
final def writeInt32(v: Array[Int]): Unit

Tries to write an array of Int32s (Ints) to the current getFilePointer().

Tries to write an array of Int32s (Ints) to the current getFilePointer().

@throws(scala.Predef.classOf[java.io.IOException])
final def writeInt64(v: Long): Unit

Tries to write an Int64 (Long) to the current getFilePointer().

Tries to write an Int64 (Long) to the current getFilePointer().

@throws(scala.Predef.classOf[java.io.IOException])
final def writeInt64(v: Array[Long]): Unit

Tries to write an array of Int64s (Longs) to the current getFilePointer().

Tries to write an array of Int64s (Longs) to the current getFilePointer().

@throws(scala.Predef.classOf[java.io.IOException])
final def writeInt8(v: Byte): Unit

Tries to write an Int8 (Byte) to the current getFilePointer().

Tries to write an Int8 (Byte) to the current getFilePointer().

@throws(scala.Predef.classOf[java.io.IOException])
final def writeInt8(v: Array[Byte]): Unit

Tries to write n Int8s (Bytes) to the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to write n Int8s (Bytes) to the current getFilePointer(). Will throw an exception if it encounters an end of file.

@throws(scala.Predef.classOf[java.io.IOException])
final def writeLong(value: Long): Unit

Alias, in java style, for breeze.io.RandomAccessFile.writeInt64

Alias, in java style, for breeze.io.RandomAccessFile.writeInt64

@throws(scala.Predef.classOf[java.io.IOException])
final def writeLong(value: Array[Long]): Unit

Alias, in java style, for breeze.io.RandomAccessFile.writeInt64

Alias, in java style, for breeze.io.RandomAccessFile.writeInt64

@throws(scala.Predef.classOf[java.io.IOException])
final def writeShort(v: Short): Unit

Alias, in java style, for breeze.io.RandomAccessFile.readInt16

Alias, in java style, for breeze.io.RandomAccessFile.readInt16

@throws(scala.Predef.classOf[java.io.IOException])
final override def writeShort(v: Int): Unit

Alias, in java style, for breeze.io.RandomAccessFile.readInt16

Alias, in java style, for breeze.io.RandomAccessFile.readInt16

Definition Classes
DataOutput
@throws(scala.Predef.classOf[java.io.IOException])
final def writeShort(v: Array[Short]): Unit

Alias, in java style, for breeze.io.RandomAccessFile.readInt16

Alias, in java style, for breeze.io.RandomAccessFile.readInt16

@throws(scala.Predef.classOf[java.io.IOException])
final def writeUInt16(v: Char): Unit

Tries to write a UInt16 (Char) to the current getFilePointer().

Tries to write a UInt16 (Char) to the current getFilePointer().

@throws(scala.Predef.classOf[java.io.IOException])
final def writeUInt16(v: Array[Char]): Unit

Tries to write an array of UInt16s (Chars) to the current getFilePointer().

Tries to write an array of UInt16s (Chars) to the current getFilePointer().

@throws(scala.Predef.classOf[java.io.IOException])
final def writeUInt32(v: Long): Unit

Tries to write a UInt32 (represented by Int) to the current getFilePointer().

Tries to write a UInt32 (represented by Int) to the current getFilePointer().

@throws(scala.Predef.classOf[java.io.IOException])
final def writeUInt32(v: Array[Long]): Unit

Tries to write an array of Int32s (Ints) to the current getFilePointer().

Tries to write an array of Int32s (Ints) to the current getFilePointer().

@throws(scala.Predef.classOf[java.io.IOException])
final def writeUInt64(v: ULong): Unit

Tries to write an UInt64 (described as Long) to the current getFilePointer(). Will throw error if value < 0.

Tries to write an UInt64 (described as Long) to the current getFilePointer(). Will throw error if value < 0.

@throws(scala.Predef.classOf[java.io.IOException])
final def writeUInt64(v: Array[ULong]): Unit

Tries to write an array of UInt64s (input as spire.math.ULong) to the current getFilePointer(). Will throw error if value < 0.

Tries to write an array of UInt64s (input as spire.math.ULong) to the current getFilePointer(). Will throw error if value < 0.

@throws(scala.Predef.classOf[java.io.IOException])

Tries to write an UInt64Shifted (shifted down to Long range) to the current getFilePointer().

Tries to write an UInt64Shifted (shifted down to Long range) to the current getFilePointer().

@throws(scala.Predef.classOf[java.io.IOException])

Tries to write an array of UInt64Shifted (shifted down to Long range) to the current getFilePointer().

Tries to write an array of UInt64Shifted (shifted down to Long range) to the current getFilePointer().

@throws(scala.Predef.classOf[java.io.IOException])
final def writeUInt8(value: Short): Unit

Tries to write a UInt8 to the current getFilePointer().

Tries to write a UInt8 to the current getFilePointer().

@throws(scala.Predef.classOf[java.io.IOException])
final def writeUInt8(values: Array[Short]): Unit

Tries to write n UInt8s (Bytes) at the current getFilePointer(). Will throw an exception if it encounters an end of file.

Tries to write n UInt8s (Bytes) at the current getFilePointer(). Will throw an exception if it encounters an end of file.

override def writeUTF(value: String): Unit

Pass on to java.io.RandomAccessFile

Pass on to java.io.RandomAccessFile

Definition Classes
DataOutput
@throws(scala.Predef.classOf[java.io.IOException])
final def writeUnsignedByte(value: Short): Unit

Alias, in java style, for breeze.io.RandomAccessFile.writeUInt8

Alias, in java style, for breeze.io.RandomAccessFile.writeUInt8

@throws(scala.Predef.classOf[java.io.IOException])
final def writeUnsignedByte(values: Array[Short]): Unit

Alias, in java style, for breeze.io.RandomAccessFile.writeUInt8

Alias, in java style, for breeze.io.RandomAccessFile.writeUInt8

@throws(scala.Predef.classOf[java.io.IOException])
final def writeUnsignedShort(value: Int): Unit

Alias, in java style, for breeze.io.RandomAccessFile.writeUInt16, but reads as Int.

Alias, in java style, for breeze.io.RandomAccessFile.writeUInt16, but reads as Int.

@throws(scala.Predef.classOf[java.io.IOException])
final def writeUnsignedShort(value: Array[Int]): Unit

Alias, in java style, for breeze.io.RandomAccessFile.writeUInt16, but reads as Int.

Alias, in java style, for breeze.io.RandomAccessFile.writeUInt16, but reads as Int.

Concrete fields

val rafObj: RandomAccessFile