/** * reads up to length bytes from the file pointer referenced by handle. Reading stops when up to length bytes have been read, EOF (end of file) is reached * * @param int $l1desc level 1 file descriptor * @param int $length up to how many bytes to read. * @return the read string. */ public function fileRead($l1desc, $length) { $openedDataObjInp = new RP_OpenedDataObjInp($l1desc, $length); $msg = new RODSMessage("RODS_API_REQ_T", $openedDataObjInp, $GLOBALS['PRODS_API_NUMS']['OPENED_DATA_OBJ_READ_AN']); fwrite($this->conn, $msg->pack()); // send it $msg = new RODSMessage(); $intInfo = (int) $msg->unpack($this->conn); if ($intInfo < 0) { throw new RODSException("RODSConn::fileRead has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["{$intInfo}"]); } return $msg->getBinstr(); }