]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - inc/3rdparty/libraries/send2kindle/MOBIClass/FileElement.php
4 * Description of FileElement
15 * Make a record to be stored in a file
16 * @param Record $record
18 public function __construct($elements = array()){
19 $this->elements
= $elements;
22 public function getByteLength(){
23 return $this->getLength();
26 public function getLength(){
28 foreach($this->elements
as $val){
29 $total +
= $val->getByteLength();
34 public function offsetToEntry($name){
36 foreach($this->elements
as $key=>$value){
40 $pos +
= $value->getByteLength();
45 public function exists($key){
46 return isset($this->elements
[$key]);
52 public function get($key){
53 return $this->elements
[$key];
58 * @param FileObject $value
60 public function set($key, $value){
61 $this->elements
[$key] = $value;
64 public function add($key, $value){
65 $this->elements
[$key] = $value;
68 public function serialize() {
70 foreach($this->elements
as $val){
71 $result .= $val->serialize();
76 public function unserialize($data) {
77 //TODO: If reading is needed -> way more complex
80 public function __toString(){
81 $output = "FileElement (".$this->getByteLength()." bytes): {\n";
82 foreach($this->elements
as $key=>$value){
83 $output .= "\t".$key.": ".$value."\n";