gS3
[ class tree: gS3 ] [ index: gS3 ] [ all elements ]

Class: gs3_IO

Source Location: /gs3.php

Class Overview


Simple Storage Service stream wrapper


Author(s):

Copyright:

  • 2007 Cesar D. Rodas

Variables

Methods



Class Details

[line 78]
Simple Storage Service stream wrapper



Tags:

author:  Cesar D. Rodas <saddor@gmail.com>
copyright:  2007 Cesar D. Rodas
access:  public
license:  BSD License


[ Top ]


Class Variables

$actualDir =

[line 153]

Actual file in the directory



Tags:

access:  private

Type:   int


[ Top ]

$actualTag =

[line 160]

Actual tag, used in XML parse



Tags:

access:  private

Type:   string


[ Top ]

$bufActSize =

[line 139]

Buffer Max Size



Tags:

access:  private

Type:   int


[ Top ]

$buffer =

[line 125]

In memory file buffer.



Tags:

access:  private

Type:   string


[ Top ]

$bufSize =

[line 132]

Buffer actual size



Tags:

access:  private

Type:   int


[ Top ]

$contructed =

[line 92]

True if this class was contructed



Tags:

access:  private

Type:   bool


[ Top ]

$dirList =

[line 146]

Array with list of files



Tags:

access:  private

Type:   array


[ Top ]

$http =

[line 84]

HTTP Connection class



Tags:

access:  private

Type:   object


[ Top ]

$isEOF =

[line 174]

Flag for End Of file



Tags:

access:  private

Type:   bool


[ Top ]

$path =

[line 99]

The opened URL



Tags:

access:  private

Type:   string


[ Top ]

$position =

[line 118]

Actual position of the file



Tags:

access:  private

Type:   int


[ Top ]

$stat =

[line 167]

Stats Variable



Tags:

access:  private

Type:   array


[ Top ]

$tAcl =

[line 112]

Type of ACL of a opened file for write



Tags:

access:  private

Type:   int


[ Top ]

$tOpen =

[line 105]

Type of open.



Tags:

var:  True for write, false only for read
access:  private

Type:   bool


[ Top ]



Class Methods


constructor gs3_IO [line 175]

gs3_IO gs3_IO( )



[ Top ]

method accessId2String [line 631]

string accessId2String( int $access)

Return the string of the access



Tags:

return:  The string of access
access:  private


Parameters:

int   $access   Type of access

[ Top ]

method dir_closedir [line 503]

void dir_closedir( )

close dir



[ Top ]

method dir_opendir [line 447]

void dir_opendir( $path, $options)

Implementing opendir()



Parameters:

   $path  
   $options  

[ Top ]

method dir_readdir [line 487]

void dir_readdir( )

Readdir



[ Top ]

method dir_rewinddir [line 495]

void dir_rewinddir( )

Rewind dir



[ Top ]

method getMimeOfFileType [line 667]

string getMimeOfFileType( string $name)

Return the "content/type" of a file based on the file name



Tags:

return:  mime type
access:  private


Parameters:

string   $name   File name

[ Top ]

method getPathNumberOfComponents [line 821]

int getPathNumberOfComponents( string $path)

Get the number of components of a path

Example: s3://path/cesar = 2 s3://path/ = 1




Tags:

access:  private


Parameters:

string   $path   Path

[ Top ]

method getS3AuthCode [line 602]

void getS3AuthCode( string $ReqMethod, &$args, array $args)

Return the Authentication code



Tags:

access:  private


Parameters:

string   $ReqMethod   the kind of Request method (PUT, DELETE, GET, POST)
array   $args   The httpclient arguments
   &$args  

[ Top ]

method hex2b64 [line 652]

string hex2b64( string $str)

Encode a field for amazon auth



Tags:

access:  private


Parameters:

string   $str   String to encode

[ Top ]

method initialize [line 539]

void initialize( string $name, string $rmethod, string &$url)

Initialize a the httpclient



Tags:

access:  private


Parameters:

string   $name   file name
string   $rmethod   What to do.. PUT, GET, DELETE...
string   &$url   By reference function with get the URL

[ Top ]

method mkdir [line 383]

bool mkdir( string $name, [int $mode = _PRIVATE])

Create a Directory or Bucket

Example of usage:

  1. <?php
  2.     include("gs3.php");
  3.     define('S3_KEY''059d545s4d6554')//fake-code
  4.     define('S3_PRIVATE','dsadsadshajkdhas'//fake-code
  5.     $e=mkdir("s3://foldername",_PRIVATE||_PUBLIC_READ||_PUBLIC_WRITE);
  6.     if ($eecho "Done";
  7.     else echo "Error! Amazon said: ".$amazonResponse;
  8. ?>
Nested folders could not be done!, that is a Amazon S3 Limitation




Tags:

return:  true if success


Parameters:

string   $name   Bucket name
int   $mode   Permision of the bucket

[ Top ]

method Process [line 566]

void Process( array $arguments, array &$gHeaders)

Open connection and ask something



Tags:

access:  private


Parameters:

array   $arguments  
array   &$gHeaders  

[ Top ]

method rmdir [line 429]

void rmdir( $name, $options)

Implements the unlink referece



Parameters:

   $name  
   $options  

[ Top ]

method stream_close [line 322]

bool stream_close( )

Close the Connection

Close the connecting, and if the file was opened for write the file is sended to the S3 server.




[ Top ]

method stream_eof [line 310]

void stream_eof( )

EOF

implements the eof()




[ Top ]

method stream_open [line 199]

void stream_open( $path, $mode, $options, &$opened_path)

Open



Parameters:

   $path  
   $mode  
   $options  
   &$opened_path  

[ Top ]

method stream_read [line 291]

string stream_read( $count)

Read a data from the S3 object



Parameters:

   $count  

[ Top ]

method stream_seek [line 258]

int|bool stream_seek( int $offset, int $whence)

Set a new position.



Tags:

return:  The new position or false.


Parameters:

int   $offset   Number of bits to move
int   $whence   SEEK_SET, SEEK_CUR or SEEK_END

[ Top ]

method stream_tell [line 248]

int stream_tell( )

Return the actual pointer position



[ Top ]

method stream_write [line 277]

int|bool stream_write( $data)

Write a $data into the buffer.



Tags:

return:  Numbe of bytes written or false.


Parameters:

   $data  

[ Top ]

method unlink [line 410]

void unlink( $name)

Implements the unlink referece



Parameters:

   $name  

[ Top ]

method url_stat [line 343]

array url_stat( $path, $flags)

Implements the Stats



Parameters:

   $path  
   $flags  

[ Top ]

method _dirData [line 527]

void _dirData( &$parser, &$data)

Handle data of XML tags

Save in an array when TAG == "KEY"




Parameters:

   &$parser  
   &$data  

[ Top ]

method _dirEnd [line 519]

void _dirEnd( &$parser, &$name)

Handle end of XML tags



Parameters:

   &$parser  
   &$name  

[ Top ]

method _dirStart [line 512]

void _dirStart( &$parser, &$name, &$attribs)

Handle start of XML tags



Parameters:

   &$parser  
   &$name  
   &$attribs  

[ Top ]


Documentation generated on Sun, 23 Sep 2007 05:12:42 -0300 by phpDocumentor 1.4.0a2