MacBinary Class Reference
[SpecialPage]

MacBinary signature checker and data fork extractor, for files uploaded from Internet Explorer for Mac. More...

List of all members.

Public Member Functions

 __construct ($filename)
 open ($filename)
 The file must be seekable, such as local filesystem.
 isValid ()
 Does this appear to be a valid MacBinary archive?
 dataForkLength ()
 Get length of data fork.
 extractData ($destination)
 Copy the data fork to an external file or resource.
 close ()
 loadHeader ()
 Check if the given file appears to be MacBinary-encoded, as Internet Explorer on Mac OS may provide for unknown types.
 calcCRC ($data, $seed=0)
 Calculate a 16-bit CRC value as for MacBinary headers.
 copyBytesTo ($destination, $bytesToCopy)
 hexdump ($data)
 Hex dump of the header for debugging.


Detailed Description

MacBinary signature checker and data fork extractor, for files uploaded from Internet Explorer for Mac.

Copyright (C) 2005 Brion Vibber <brion@pobox.com> Portions based on Convert::BinHex by Eryq et al http://www.mediawiki.org/

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Definition at line 28 of file MacBinary.php.


Constructor & Destructor Documentation

MacBinary::__construct ( filename  ) 

Definition at line 29 of file MacBinary.php.

References $filename, loadHeader(), and open().


Member Function Documentation

MacBinary::calcCRC ( data,
seed = 0 
)

Calculate a 16-bit CRC value as for MacBinary headers.

Adapted from perl5 Convert::BinHex by Eryq, based on the mcvert utility (Doug Moore, April '87), with magic array thingy by Jim Van Verth. http://search.cpan.org/~eryq/Convert-BinHex-1.119/lib/Convert/BinHex.pm

Parameters:
string $data
int $seed
Returns:
int
Access:
private

Definition at line 181 of file MacBinary.php.

References $i.

Referenced by loadHeader().

MacBinary::close (  ) 

Definition at line 83 of file MacBinary.php.

MacBinary::copyBytesTo ( destination,
bytesToCopy 
)

Parameters:
resource $destination
int $bytesToCopy
Returns:
bool
Access:
private

Definition at line 234 of file MacBinary.php.

Referenced by extractData().

MacBinary::dataForkLength (  ) 

Get length of data fork.

Returns:
int

Definition at line 61 of file MacBinary.php.

MacBinary::extractData ( destination  ) 

Copy the data fork to an external file or resource.

Parameters:
resource $destination
Returns:
bool

Definition at line 70 of file MacBinary.php.

References copyBytesTo(), and isValid().

MacBinary::hexdump ( data  ) 

Hex dump of the header for debugging.

Access:
private

Definition at line 247 of file MacBinary.php.

References $i, $wgDebugLogFile, and wfDebug().

MacBinary::isValid (  ) 

Does this appear to be a valid MacBinary archive?

Returns:
bool

Definition at line 53 of file MacBinary.php.

Referenced by extractData().

MacBinary::loadHeader (  ) 

Check if the given file appears to be MacBinary-encoded, as Internet Explorer on Mac OS may provide for unknown types.

http://www.lazerware.com/formats/macbinary/macbinary_iii.html If ok, load header data.

Returns:
bool
Access:
private

Definition at line 98 of file MacBinary.php.

References $fname, calcCRC(), and wfDebug().

Referenced by __construct().

MacBinary::open ( filename  ) 

The file must be seekable, such as local filesystem.

Remote URLs probably won't work.

Parameters:
string $filename

Definition at line 40 of file MacBinary.php.

References $filename.

Referenced by __construct().


The documentation for this class was generated from the following file:

Generated on Sat Sep 5 02:08:42 2009 for MediaWiki by  doxygen 1.5.9