Class Rider


  • public class Rider
    extends Object
    Rider, to be placed onto a file
    multiple riders might be placed for reading and writing
    • Field Summary

      Fields 
      Modifier and Type Field Description
      boolean eof
      end of file reached
      int res
      result of last operation = 0, operation successful = 1, end of file reached = 2, file does not exist = 3, no blocks left in file system = 4, max number of blocks for this file is exceeded = 5, writing not at end of file
    • Constructor Summary

      Constructors 
      Constructor Description
      Rider()  
    • Field Detail

      • eof

        public boolean eof
        end of file reached
      • res

        public int res
        result of last operation = 0, operation successful = 1, end of file reached = 2, file does not exist = 3, no blocks left in file system = 4, max number of blocks for this file is exceeded = 5, writing not at end of file
    • Constructor Detail

      • Rider

        public Rider()
    • Method Detail

      • set

        public void set​(File f,
                        int pos)
        sets rider at position if pos < 0, sets position to 0 if pos > length of file, sets position to file.len
        Parameters:
        f - file
        pos - position (in number of bytes)
      • pos

        public int pos()
        Returns position of rider.
        Returns:
        Position of rider in byte offset.
      • base

        public File base()
        Returns file associated with this rider.
        Returns:
        File where this rider is placed on.
      • readBool

        public boolean readBool()
        reads boolean
        Returns:
        Boolean value.
      • readByte

        public byte readByte()
        reads byte
        Returns:
        Byte value.
      • readShort

        public short readShort()
        reads short
        Returns:
        Short value.
      • readInt

        public int readInt()
        reads int
        Returns:
        Integer value.
      • writeBool

        public void writeBool​(boolean x)
        writes boolean
        Parameters:
        x - Boolean value.
      • writeByte

        public void writeByte​(byte x)
        writes byte
        Parameters:
        x - Byte value.
      • writeShort

        public void writeShort​(short x)
        writes short
        Parameters:
        x - Short value.
      • writeInt

        public void writeInt​(int x)
        writes int
        Parameters:
        x - Integer value.