Zend Framework  1.12
Public Member Functions | Protected Member Functions | List of all members
Zend_Search_Lucene_Storage_File Class Reference

Public Member Functions

 seek ($offset, $whence=SEEK_SET)
 Sets the file position indicator and advances the file pointer.
 
 tell ()
 Get file position.
 
 flush ()
 Flush output.
 
 lock ($lockType, $nonBlockinLock=false)
 Lock file.
 
 unlock ()
 Unlock file.
 
 readByte ()
 Reads a byte from the current position in the file and advances the file pointer.
 
 writeByte ($byte)
 Writes a byte to the end of the file.
 
 readBytes ($num)
 Read num bytes from the current position in the file and advances the file pointer.
 
 writeBytes ($data, $num=null)
 Writes num bytes of data (all, if $num===null) to the end of the string.
 
 readInt ()
 Reads an integer from the current position in the file and advances the file pointer.
 
 writeInt ($value)
 Writes an integer to the end of file.
 
 readLong ()
 Returns a long integer from the current position in the file and advances the file pointer.
 
 writeLong ($value)
 Writes long integer to the end of file.
 
 readLong32Bit ()
 Returns a long integer from the current position in the file, advances the file pointer and return it as float (for 32-bit platforms).
 
 writeLong32Bit ($value)
 Writes long integer to the end of file (32-bit platforms implementation)
 
 readVInt ()
 Returns a variable-length integer from the current position in the file and advances the file pointer.
 
 writeVInt ($value)
 Writes a variable-length integer to the end of file.
 
 readString ()
 Reads a string from the current position in the file and advances the file pointer.
 
 writeString ($str)
 Writes a string to the end of file.
 
 readBinary ()
 Reads binary data from the current position in the file and advances the file pointer.
 

Protected Member Functions

 _fread ($length=1)
 Reads $length number of bytes at the current position in the file and advances the file pointer.
 
 _fwrite ($data, $length=null)
 Writes $length number of bytes (all, if $length===null) to the end of the file.
 

Member Function Documentation

_fread (   $length = 1)
abstractprotected

Reads $length number of bytes at the current position in the file and advances the file pointer.

Parameters
integer$length
Returns
string
_fwrite (   $data,
  $length = null 
)
abstractprotected

Writes $length number of bytes (all, if $length===null) to the end of the file.

Parameters
string$data
integer$length
flush ( )
abstract

Flush output.

Returns true on success or false on failure.

Returns
boolean
lock (   $lockType,
  $nonBlockinLock = false 
)
abstract

Lock file.

Lock type may be a LOCK_SH (shared lock) or a LOCK_EX (exclusive lock)

Parameters
integer$lockType
Returns
boolean
readBinary ( )

Reads binary data from the current position in the file and advances the file pointer.

Returns
string
readByte ( )

Reads a byte from the current position in the file and advances the file pointer.

Returns
integer
readBytes (   $num)

Read num bytes from the current position in the file and advances the file pointer.

Parameters
integer$num
Returns
string
readInt ( )

Reads an integer from the current position in the file and advances the file pointer.

Returns
integer
readLong ( )

Returns a long integer from the current position in the file and advances the file pointer.

Returns
integer|float
Exceptions
Zend_Search_Lucene_Exception

Check, that we work in 64-bit mode. fseek() uses long for offset. Thus, largest index segment file size in 32bit mode is 2Gb

readLong32Bit ( )

Returns a long integer from the current position in the file, advances the file pointer and return it as float (for 32-bit platforms).

Returns
integer|float
Exceptions
Zend_Search_Lucene_Exception
readString ( )

Reads a string from the current position in the file and advances the file pointer.

Returns
string

This implementation supports only Basic Multilingual Plane (BMP) characters (from 0x0000 to 0xFFFF) and doesn't support "supplementary characters" (characters whose code points are greater than 0xFFFF) Java 2 represents these characters as a pair of char (16-bit) values, the first from the high-surrogates range (0xD800-0xDBFF), the second from the low-surrogates range (0xDC00-0xDFFF). Then they are encoded as usual UTF-8 characters in six bytes. Standard UTF-8 representation uses four bytes for supplementary characters.

readVInt ( )

Returns a variable-length integer from the current position in the file and advances the file pointer.

Returns
integer
seek (   $offset,
  $whence = SEEK_SET 
)
abstract

Sets the file position indicator and advances the file pointer.

The new position, measured in bytes from the beginning of the file, is obtained by adding offset to the position specified by whence, whose values are defined as follows: SEEK_SET - Set position equal to offset bytes. SEEK_CUR - Set position to current location plus offset. SEEK_END - Set position to end-of-file plus offset. (To move to a position before the end-of-file, you need to pass a negative value in offset.) Upon success, returns 0; otherwise, returns -1

Parameters
integer$offset
integer$whence
Returns
integer
tell ( )
abstract

Get file position.

Returns
integer
unlock ( )
abstract

Unlock file.

writeByte (   $byte)

Writes a byte to the end of the file.

Parameters
integer$byte
writeBytes (   $data,
  $num = null 
)

Writes num bytes of data (all, if $num===null) to the end of the string.

Parameters
string$data
integer$num
writeInt (   $value)

Writes an integer to the end of file.

Parameters
integer$value
writeLong (   $value)

Writes long integer to the end of file.

Parameters
integer$value
Exceptions
Zend_Search_Lucene_Exception

Check, that we work in 64-bit mode. fseek() and ftell() use long for offset. Thus, largest index segment file size in 32bit mode is 2Gb

writeLong32Bit (   $value)

Writes long integer to the end of file (32-bit platforms implementation)

Parameters
integer | float$value
Exceptions
Zend_Search_Lucene_Exception
writeString (   $str)

Writes a string to the end of file.

Parameters
string$str
Exceptions
Zend_Search_Lucene_Exception

This implementation supports only Basic Multilingual Plane (BMP) characters (from 0x0000 to 0xFFFF) and doesn't support "supplementary characters" (characters whose code points are greater than 0xFFFF) Java 2 represents these characters as a pair of char (16-bit) values, the first from the high-surrogates range (0xD800-0xDBFF), the second from the low-surrogates range (0xDC00-0xDFFF). Then they are encoded as usual UTF-8 characters in six bytes. Standard UTF-8 representation uses four bytes for supplementary characters.

String is already in Java 2 representation. We should only calculate actual string length and replace by

writeVInt (   $value)

Writes a variable-length integer to the end of file.

Parameters
integer$value