GetItem Method

Retrieve an item from the server and store it in a local buffer.

Syntax

object.GetItem( ItemType, Selector, Buffer, [Length], [Options] )

Remarks

The GetItem method retrieves an item from the server and copies the contents to the specified buffer . This method will cause the current thread to block until the file transfer completes, a timeout occurs or the transfer is canceled. During the transfer, the OnProgress event will fire periodically, enabling the application to update any user interface objects such as a progress bar.

ItemType
An integer value which identifies the type of resource being requested. See the Select method for the complete list of valid item types which may be specified. The item type cannot specify a directory or index, otherwise an error will be returned.
Selector
The selector string which identifies the resource on the remote server. The item selector is considered to be an opaque string, and does not have any meaning beyond identifying the resource on the Gopher server.
Buffer
This parameter specifies the local buffer that the data will be stored in. If the variable is a String type, then the data will be returned as a string of characters. This is the most appropriate data type to use if the file on the server is a text file. If the remote file contains binary data, it is recommended that a Byte array variable be specified as the argument to this method.
Length
An optional integer argument that will contain the number of bytes copied into the buffer when the method returns.
Options
An optional integer value which specifies one or more options. This argument is constructed by using a bitwise operator with any of the following values:
Value Constant Description
0 gopherTransferDefault The default transfer mode. The item data is copied to the local system exactly as it is stored on the server.
1 gopherTransferConvert If the item being retrieved from the server is textual, the data is automatically converted so that the end of line character sequence is compatible with the Windows platform. Individual carriage return or linefeed characters are converted to carriage return/linefeed character sequences.

Return Value

A value of zero is returned if the operation was successful, otherwise a non-zero error code is returned which indicates the cause of the failure.

See Also

StoreItem Method, OnProgress Event


Copyright © 2008 Catalyst Development Corporation. All rights reserved.