From VisualWorks®, 7.6 of February 1, 2008 on February 1, 2008 at 12:33:35 pm (Dialog confirm: 'You are filing-in a Parcel source file!\\While this is possible it will not have\the same effect as loading the parcel.\None of the Parcel''s prerequisites will\be loaded and none of its load actions\will be performed.\\Are you sure you want to file-in?' withCRs) ifFalse: [self error: 'Parcel file-in abandoned. Choose terminate or close.'] <name>Net</name> <environment>Smalltalk</environment> <private>false</private> <imports> private Smalltalk.* private OS.IOConstants.* Protocols.* </imports> <category>Net-Namespace</category> <attributes> <package>NetClientBase</package> </attributes> <comment> Net
Net is the namespace for the the Net clients.
</comment> <class> <name>MimeTypeDescriptor</name> <environment>Net</environment> <super>Core.Object</super> <private>false</private> none contentType binary properties <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.MimeTypeDescriptor
MimeTypeDescriptor is used to set the Content-Type field for a MimeEntity. Instance Variables: contentType <String> 'type/subtype' string. Should be lowercase binary <Boolean> answers whether or not this type is binary properties <Dictionary> can hold additional description Shared Class Variables: FileExtensionToMimeTypeMap <Dictonary key: String value: String> maps file extensions to mime type strings MimeCharsetToEncodingMap <Dictionary key: Symbol value: Symbol> maps encoding symbols used by VW to Mime charset identifiers MimeTypeRegistry <Dictionary key: String value: MimeTypeDescriptor> maps Mime type strings to descriptor instances
</comment> <class> <name>NetError</name> <environment>Net</environment> <super>Core.Error</super> <private>false</private> none <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.NetError
NetError is supert class for all Net client errors
</comment> <class> <name>NetNotification</name> <environment>Net</environment> <super>Core.Notification</super> <private>false</private> none <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.NetNotification
NetNotification is super class for all Net client notifications Shared Variables LogToTranscript <Boolean> if it is true all notifications will printed to Transcript. It is false by default.
</comment> <class> <name>UnsupportedCharacterReplacement</name> <environment>Net</environment> <super>Net.NetNotification</super> <private>false</private> none <imports></imports> <category>Net-Support</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.UnsupportedCharacterReplacement
UnsupportedCharacterReplacement is signaled by the ReplaceUnsupportedCharacters stream error policy. This allows mime parsers to recover when encountering characters that are not supported by the parser encoder. This notification can be resumed with specific replacement character. By default, the invalid characters will be replaced with ASCII character NUL (code 0). Example (in this case the trademark character is not valid in ISO-8859-1 encoding (the default encoding for header fields) and gets replaced with an underscore): string := 'Date: Mon, 19 May 2003 13:52:36 +0200 Subject: hello Content-Type: multipart/mixed; boundary="----------lNT1O53UKi8GkFrVZPze3O" ------------lNT1O53UKi8GkFrVZPze3O Content-Disposition: attachment; filename="Cinom™.txt" Content-Type: application/octet-stream; name="Cinom™.txt" some bytes ------------lNT1O53UKi8GkFrVZPze3O-- '. [ MimeBuildHandler new removeContentTransferEncoding: true; readFrom: string readStream. ] on: UnsupportedCharacterReplacement do: [ :ex | ex resume: $_ ].
</comment> <class> <name>SimpleScanner</name> <environment>Net</environment> <super>Core.Object</super> <private>false</private> none source hereChar token tokenType saveComments currentComment classificationMask sourceTrailStream acceptNonAsciiCharacters classificationTable acceptNonAsciiCharacters <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.SimpleScanner
Scanners are used to tokenize the contents of individual protocol messages. Subclasses must implement the following messages: tokenization nextToken Instance Variables: buffer <WriteStream> buffer classificationMask <Integer> classification mask for the current character (hereChar) currentComment <String> current comment hereChar <Character> current character lineEndCRLF <Number> lineEndCRLF saveComments <Boolean> defines whether or not to save comments source <EncodedStream> stream to parse sourceTrailStream <WriteStream> can hold a copy of parsed source if it is set on (#sourceTrailOn) token <String> current token tokenType <ByteSymbol> token type acceptNonAsciiCharacters <Boolean> if the option is false the NonASCIICharacter exception will be raised in cases if there is no classification mask in the classification table. If the option is true the hereChar will be set to the non ascii character. Class Instance Variables: acceptNonAsciiCharacters <Boolean> the default value classificationTable <WordArray> the table is used to validate types of scanned characters.
</comment> <class> <name>INIScanner</name> <environment>Net</environment> <super>Net.SimpleScanner</super> <private>false</private> none <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.INIScanner
INIScanner is used to parse *.ini files
</comment> <class> <name>NetConnection</name> <environment>Net</environment> <super>Core.Object</super> <private>false</private> none stream encoding <imports> private OS.IOConstants.* </imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.NetConnection
This is an abstract superclass for NetClient connections. It maintains its connection/socket stream Subclasses must implement the following messages: class default values defaultPortNumber Instance Variables: stream <ExternalReadAppendStream> external connection stream Class Instance Variables: encoding <Symbol> default stream encoding
</comment> <class> <name>Settings</name> <environment>Net</environment> <super>Core.Object</super> <private>false</private> none httpProxyHostAspect <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.Settings
Settings is a central repository for various configurable parameters of Internet Connectivity clients. Class Instance Variables: httpProxyHostAspect <Object> caches the httpProxyHost parameter Shared Class Variables: Registry <IdentityDictionary> holds all settings
</comment> <class> <name>MailIncrementNotification</name> <environment>Tools</environment> <super>Net.NetNotification</super> <private>false</private> none endingCount <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Tools.MailIncrementNotification
This notification is signaled by the mail protocol implementations to allow monitoring of progress in longer operations. Instance Variables: endingCount <Integer> final count expected against which to measure the progress
</comment> <class> <name>NetProtocolInterpreter</name> <environment>Net</environment> <super>Core.Object</super> <private>false</private> none connection defaultNetConnection <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.NetProtocolInterpreter
Protocol interpreters implement the specific mechanics of the various protocols. They represent and execute the rules controlling the communication with the server. They are internal components used by the clients to perform their communications. The communication is conducted over a network connection represented by NetConnection classes. The only interface between the PI and NetConnection is through connectToHost: port: timeout: disconnect The #useSecureConnection/#useDefaultConnection messages will switch between secured and unsecured connection. Instance Variables: connection <NetConnection> client's connection to the server Class Instance Variables: defaultNetConnection <Class> the default connection class Shared Class Variables: CRLF <String> constant string containing the CRLF character sequence
</comment> <class> <name>NonASCIICharacter</name> <environment>Net</environment> <super>Net.NetError</super> <private>false</private> none <imports></imports> <category>NetClientBase</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.NonASCIICharacter
This exception is raised when a scanner encounters a character outside of the ASCII character range.
</comment> <class> <name>StreamSegment</name> <environment>Net</environment> <super>Core.Object</super> <private>false</private> none source offset size position <imports> private OS.IOConstants.* </imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.StreamSegment
StreamSegment are used to delimit portions of readable streams and representing them as virtual substreams. A segment will not allow reading or writing outside of its boundaries and ensures that the underlying streams is properly positioned for any stream operation performed on the segment. Instance Variables: offset <SmallInteger> the parent stream position the segment starts from position <SmallInteger> current segment position size <SmallInteger> the segment size source <Stream> the parent stream
</comment> <class> <name>ScannedLineSkipped</name> <environment>Net</environment> <super>Net.NetNotification</super> <private>false</private> none <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <class> <name>ReplaceUnsupportedCharacters</name> <environment>Net</environment> <super>Core.IllegalCharacterStreamErrorPolicy</super> <private>false</private> none <imports></imports> <category>Net-Support</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.ReplaceUnsupportedCharacters
ReplaceUnsupportedCharacters raises the UnsupportedCharacterReplacement exception is there is an invalid character
</comment> <class> <name>HostSpec</name> <environment>Net</environment> <super>Core.Object</super> <private>false</private> none name netUser type port <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.HostSpec
HostSpec describes a network server and an associated user account. Instance Variables: name <String> the server host name (the DNS add netUser <NetUser> the user information used for authentication with the server port <Number> the server port number type <String> the protocol that the server supports such as 'http'/'imap'
</comment> <class> <name>UTF7StreamEncoder</name> <environment>Net</environment> <super>Protocols.Base64StreamEncoder</super> <private>false</private> none shifting <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.UTF7StreamEncoder
UTF7StreamEncoder is used in the context of EncodedStreams to encode/decode UTF7 character encoding.
</comment> <class> <name>NetClientState</name> <environment>Net</environment> <super>Core.Object</super> <private>false</private> none client <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.NetClientState
NetClientState is the abstract superclass for client protocol states. Subclasses must implement the following messages: accessing stateErrorClass Instance Variables: client <NetClient> a mail client
</comment> <class> <name>MessageElement</name> <environment>Net</environment> <super>Core.Object</super> <private>false</private> none source parent value <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.MessageElement
MessageElement is abstract class for MIME header and body components. Subclasses must implement the following messages: parsing parse: Instance Variables: parent <MimeEntity> the message body parent or mime entity parent if the message if multipart source <Stream> the message source stream value <MimeEntity|SimpleBody|MultipartBody> the contents of the message element
</comment> <class> <name>NetClientError</name> <environment>Net</environment> <super>Net.NetError</super> <private>false</private> none <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.NetClientError
NetClientErrors are raised by the mail clients for various protocol related errors.
</comment> <class> <name>NetworkResponse</name> <environment>Net</environment> <super>Core.Object</super> <private>false</private> none code messageStream stream <imports> Tools.* </imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.NetworkResponse
This class represents the more generic aspects of network responses. Currently it is only used for the FTP protocol and may eventually be merged into FTP response completely. Instance Variables: code <String> response code messageStream <Stream> a stream with the parsed response stream <SimpleScanner> stream the response is read from
</comment> <class> <name>NetUser</name> <environment>Net</environment> <super>Core.Object</super> <private>false</private> none username password fullName account savePassword mailAddress <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.NetUser
NetUser holds a client authentication information. Most internet services require a user ID, and usually a password, to gain access (log in) to the service. For very simple services, such as FTP, the user name and password are simply String data. Most of the clients, however, require the user ID and password to be specified by an instance of NetUser. A NetUser instance is a convenient holder for several pieces of user information, as is done by the Network Settings tool. It holds at least the user ID and password, but also the user's full name, an account name and an email address. To create a NetUser instance, send a username:password: message to the class, with the user name and password specified as strings: user := NetUser username: 'Fred' password: 'dont_ask' To add other information items, send the appropriate set message: user fullName: 'Frederick P. User'; mailAddress: 'fpuser@someplace.net'. There are also setter methods for changing the user name and password, as well as getter methods for all of these data items. Instance Variables: account <String> account fullName <String> full user name mailAddress <String> mail address password <String> password savePassword <Boolean> defines whether or not to remember the password in the Net Settings username <String> username
</comment> <class> <name>NetClient</name> <environment>Net</environment> <super>Core.Object</super> <private>false</private> none user hostName portNumber clientPI retries timeout delaySeconds state defaultProtocolInterpreterClass <imports></imports> <category>Net-Clients</category> <attributes> <package>NetClientBase</package> </attributes> </class> <comment> Net.NetClient
NetClient is the abstract superclass for specific clients. However, a good deal of useful protocol, especially with respect to connections, is inherited from NetClient. It provides instance creation methods: #connectToHost: hostName #connectToHost: hostName port: portNum - Creates a client instance and establishes a connection to hostName, a String, on the default port for the protocol. If portNum is specified, that port is used instead of the default. #host: hostName #host: hostName port: portNum - Creates a client instance targeted on hostName, a String, on the default port for the protocol. If portNum is specified, that port is used instead of the default. Instance methods provide connection support, and allow you to set or get user and host information. Browse the accessing and connection method categories for useful messages. There are some exceptions but general protocol to connect and disconnect a client is as follows: #connect - establish socket connection with a server #login - a client authenticates itself #close - a client signs off and closes socket connection #disconnect - close socket connection The exception is the IMAPClient with the following differences: #logout - the connection is being terminated, and the server will close the connection #close - command permanently removes from the currently selected mailbox all messages that have the \Deleted flag set, and returns to authenticated state from selected state Clients use two types of connection: a) NetConnection which is a stream wrapper for a regular socket connection and b) SSLConnection which provides a connection protected by the secure socket layer (SSL). To make the client use the SSL connection send #useSecureConnection message to it. Message #useDefaultConnection will change the connection back to simple/unprotected socket connection. Examples 1. POP3 client with plain socket connection: pop3Client := Pop3Client new. pop3Client user: (NetUser username: 'username' password: 'password' ). pop3Client hostName: 'hostname'. pop3Client connect. 2. POP3 client with secure connection pop3Client := Pop3Client new. pop3Client user: (NetUser username: 'username' password: 'password' ). pop3Client hostName: 'hostname'. pop3Client useSSLConnection. pop3Client connect. HttpClient will open the connection based on the protocol part of the URL being accessed: http or https. Net clients do not not handle the connections directly, that is done by the associated "protocol interpreter" (PI). Subclasses must implement the following messages: accessing protocolInterpreterClass connection isConnected close Instance Variables: user <NetUser> net user authorization information hostName <String> the host name to connect to portNumber <Number> the host port number clientPI <NetProtocolInterpreter> protocol interpreter retries <ArithmeticValue> how many times to retry establishing a connection timeout <Number> how long to wait for a response (millisecond) delaySeconds <Integer> a time to wait between retrying to establish a connection state <NetClientState> current state of the mail client Class Instance Variables: defaultProtocolInterpreterClass <NetProtocolInterpreter> the default PI class to use for given client type Shared Class Variables: DefaultDelaySeconds <Integer> default time to wait between retrying to establish a connection DefaultIncomingMailClient <POP3Client | IMAPClient> default client to use for outgoing mail DefaultOutgoingMailClient <SMTPClient> default client to use for incoming mail DefaultRetries <Integer> default number of times to retry establishing a connection DefaultTimeout <Integer> default wait time for a response (millisecond) MailRegistry <Dictionary key: Symbol value: Symbol> maps mail protocol monikers to mail client class names
</comment> <name>Registry</name> <environment>Net.Settings</environment> <private>false</private> <constant>false</constant> <category>registry</category> <attributes> <package>NetClientBase</package> </attributes> <name>TokenMask</name> <environment>Net.INIScanner</environment> <private>false</private> <constant>false</constant> <category>As yet unclassified</category> <initializer>16384</initializer> <attributes> <package>NetClientBase</package> </attributes> <name>CommentChars</name> <environment>Net.INIScanner</environment> <private>false</private> <constant>false</constant> <category>As yet unclassified</category> <initializer>Array with: Character cr with: $# with: Character lf</initializer> <attributes> <package>NetClientBase</package> </attributes> <name>LogToTranscript</name> <environment>Net.NetNotification</environment> <private>false</private> <constant>false</constant> <category>default</category> <initializer>false</initializer> <attributes> <package>NetClientBase</package> </attributes> <name>CRLF</name> <environment>Net.NetProtocolInterpreter</environment> <private>false</private> <constant>true</constant> <category>constants</category> <initializer>Core.String with: (Core.Character cr) with: (Core.Character lf)</initializer> <attributes> <package>NetClientBase</package> </attributes> <name>DefaultDelaySeconds</name> <environment>Net.NetClient</environment> <private>false</private> <constant>false</constant> <category>defaults</category> <initializer></initializer> <attributes> <package>NetClientBase</package> </attributes> <name>DefaultOutgoingMailClient</name> <environment>Net.NetClient</environment> <private>false</private> <constant>false</constant> <category>defaults</category> <initializer></initializer> <attributes> <package>NetClientBase</package> </attributes> <name>MailRegistry</name> <environment>Net.NetClient</environment> <private>false</private> <constant>false</constant> <category>mailRegistry</category> <initializer></initializer> <attributes> <package>NetClientBase</package> </attributes> <name>DefaultRetries</name> <environment>Net.NetClient</environment> <private>false</private> <constant>false</constant> <category>defaults</category> <initializer></initializer> <attributes> <package>NetClientBase</package> </attributes> <name>DefaultTimeout</name> <environment>Net.NetClient</environment> <private>false</private> <constant>false</constant> <category>defaults</category> <initializer></initializer> <attributes> <package>NetClientBase</package> </attributes> <name>DefaultIncomingMailClient</name> <environment>Net.NetClient</environment> <private>false</private> <constant>false</constant> <category>defaults</category> <initializer></initializer> <attributes> <package>NetClientBase</package> </attributes> <name>FileURL</name> <environment>Net</environment> <private>false</private> <constant>true</constant> <category>Compatibility</category> <initializer> OS.FileURL </initializer> <attributes> <package>NetClientBase</package> </attributes> <name>URLwithAuthority</name> <environment>Net</environment> <private>false</private> <constant>true</constant> <category>Compatibility</category> <initializer> OS.URLwithAuthority </initializer> <attributes> <package>NetClientBase</package> </attributes> <name>URLwithPath</name> <environment>Net</environment> <private>false</private> <constant>true</constant> <category>Compatibility</category> <initializer> OS.URLwithPath </initializer> <attributes> <package>NetClientBase</package> </attributes> <name>URI</name> <environment>Net</environment> <private>false</private> <constant>true</constant> <category>Compatibility</category> <initializer> OS.URI </initializer> <attributes> <package>NetClientBase</package> </attributes> <name>UnknownURLType</name> <environment>Net</environment> <private>false</private> <constant>true</constant> <category>Compatibility</category> <initializer> OS.UnknownURLType </initializer> <attributes> <package>NetClientBase</package> </attributes> <name>URL</name> <environment>Net</environment> <private>false</private> <constant>true</constant> <category>Compatibility</category> <initializer> OS.URL </initializer> <attributes> <package>NetClientBase</package> </attributes> <name>WhiteSpaceMask</name> <environment>Net.SimpleScanner</environment> <private>false</private> <constant>false</constant> <category>masks</category> <initializer>4</initializer> <attributes> <package>NetClientBase</package> </attributes> <name>CRLF</name> <environment>Net.SimpleScanner</environment> <private>false</private> <constant>false</constant> <category>masks</category> <initializer>Array with: Character cr with: Character lf</initializer> <attributes> <package>NetClientBase</package> </attributes> <name>Cr</name> <environment>Net.SimpleScanner</environment> <private>false</private> <constant>false</constant> <category>masks</category> <initializer>Character cr</initializer> <attributes> <package>NetClientBase</package> </attributes> <name>DigitMask</name> <environment>Net.SimpleScanner</environment> <private>false</private> <constant>false</constant> <category>masks</category> <initializer>2</initializer> <attributes> <package>NetClientBase</package> </attributes> <name>Lf</name> <environment>Net.SimpleScanner</environment> <private>false</private> <constant>false</constant> <category>masks</category> <initializer>Character lf</initializer> <attributes> <package>NetClientBase</package> </attributes> <name>NilMask</name> <environment>Net.SimpleScanner</environment> <private>false</private> <constant>false</constant> <category>masks</category> <initializer>0</initializer> <attributes> <package>NetClientBase</package> </attributes> <name>EndOfLineMask</name> <environment>Net.SimpleScanner</environment> <private>false</private> <constant>false</constant> <category>masks</category> <initializer>16</initializer> <attributes> <package>NetClientBase</package> </attributes> <name>CRLFMask</name> <environment>Net.SimpleScanner</environment> <private>false</private> <constant>false</constant> <category>masks</category> <initializer>8</initializer> <attributes> <package>NetClientBase</package> </attributes> <name>AnyTextMask</name> <environment>Net.SimpleScanner</environment> <private>false</private> <constant>false</constant> <category>masks</category> <initializer>37376</initializer> <attributes> <package>NetClientBase</package> </attributes> <name>AlphabeticMask</name> <environment>Net.SimpleScanner</environment> <private>false</private> <constant>false</constant> <category>masks</category> <initializer>1</initializer> <attributes> <package>NetClientBase</package> </attributes> <name>LastUser</name> <environment>Net.NetUser</environment> <private>false</private> <constant>false</constant> <category>local globals</category> <attributes> <package>NetClientBase</package> </attributes> <name>MimeCharsetToEncodingMap</name> <environment>Net.MimeTypeDescriptor</environment> <private>false</private> <constant>false</constant> <category>As yet unclassified</category> <initializer>IdentityDictionary new</initializer> <attributes> <package>NetClientBase</package> </attributes> <name>MimeTypeRegistry</name> <environment>Net.MimeTypeDescriptor</environment> <private>false</private> <constant>false</constant> <category>As yet unclassified</category> <initializer>OrderedCollection new</initializer> <attributes> <package>NetClientBase</package> </attributes> <name>FileExtensionToMimeTypeMap</name> <environment>Net.MimeTypeDescriptor</environment> <private>false</private> <constant>false</constant> <category>As yet unclassified</category> <initializer>Dictionary new</initializer> <attributes> <package>NetClientBase</package> </attributes> <methods> Net.MimeTypeDescriptor <category>testing</category>
isBinary ^binary
isMultipart ^self type = 'multipart'
isText ^self type = 'text'
</methods> <methods> Net.MimeTypeDescriptor <category>accessing</category>
binary ^binary
binary: aBoolean binary := aBoolean
contentType ^contentType
contentType: aString " aString is 'type/subtype'. Should be lowercase " contentType := aString
hasPropertyAt: aString properties isNil ifTrue: [^false]. properties findKey: aString ifAbsent: [^false]. ^true
properties ^properties isNil ifTrue: [properties := Dictionary new] ifFalse: [properties]
propertyAt: aString ^self propertyAt: aString ifAbsent: [ nil ]
propertyAt: aString ifAbsent: aBlock ^properties isNil ifTrue: [aBlock value] ifFalse: [properties at: aString ifAbsent: aBlock]
propertyAt: aString put: aValue self properties at: aString put: aValue
subtype ^(self contentType tokensBasedOn: $/) last.
type ^(self contentType tokensBasedOn: $/) first.
</methods> <methods> Net.MimeTypeDescriptor <category>printing</category>
printOn: aStream super printOn: aStream. contentType notNil ifTrue: [aStream nextPut: $(; nextPutAll: contentType; nextPut: $)]
</methods> <methods> Net.MimeTypeDescriptor class <category>accessing mime types</category>
contentType: aString " Answer Mime type descriptor for specified type/subtype " ^self contentType: aString ifAbsent: [nil]
contentType: aString ifAbsent: aBlock " Answer Mime type descriptor for specified type/subtype " ^MimeTypeRegistry at: aString asLowercase ifAbsent: aBlock
contentTypeApplicationOctetStream ^'application/octet-stream'
contentTypeFormData ^'application/x-www-form-urlencoded'
contentTypeHtml ^'text/html'
contentTypeMessageRfc822 ^'message/rfc822'
contentTypeMultipartDigest ^'multipart/digest'
contentTypeMultipartFormData ^'application/x-www-form-urlencoded'
contentTypeMultipartMixed ^'multipart/mixed'
contentTypePlainText ^'text/plain'
contentTypeXml ^'text/xml'
defaultContentType ^self contentType: self defaultContentTypeString
defaultContentTypeString ^self contentTypePlainText
defaultUnsupportedContentType ^self contentTypeApplicationOctetStream
extension: aString " Answer Mime type descriptor for specified file extension " ^self extension: aString ifAbsent: [nil]
extension: aString ifAbsent: aBlock " Answer Mime type descriptor for specified file extension " | contentType | contentType := FileExtensionToMimeTypeMap at: aString asLowercase ifAbsent: [^aBlock value]. ^contentType isNil ifTrue: [ nil ] ifFalse: [ MimeTypeDescriptor contentType: contentType ]
guessFromContentType: aString "guesses a content type from the extension" ^self guessFromContentType: aString ifAbsent: [self contentType: self defaultUnsupportedContentType].
guessFromContentType: aString ifAbsent: aBlock "guesses a content type from the extension" ^ MimeTypeRegistry at: aString asLowercase ifAbsent: aBlock.
mimeTypeForFile: fileName "Returns content type string, guessing at the MIME type from the fileName extension. If the fileName doesn't have an extension returns default - 'application/octet-stream' " ^self guessFromExtension: fileName asFilename extension
</methods> <methods> Net.MimeTypeDescriptor class <category>class initialization</category>
defaultFileExtensionMap ^#( #('3dm' 'x-world/x-3dmf') #('3dmf' 'x-world/x-3dmf') #('a' 'application/octet-stream') #('aab' 'application/x-authorware-bin') #('aam' 'application/x-authorware-map') #('aas' 'application/x-authorware-seg') #('abc' 'text/vndabc') #('acgi' 'text/html') #('afl' 'video/animaflex') #('ai' 'application/postscript') #('aif' 'audio/aiff') #('aif' 'audio/x-aiff') #('aifc' 'audio/aiff') #('aifc' 'audio/x-aiff') #('aiff' 'audio/aiff') #('aiff' 'audio/x-aiff') #('aim' 'application/x-aim') #('aip' 'text/x-audiosoft-intra') #('ani' 'application/x-navi-animation') #('aos' 'application/x-nokia-9000-communicator-add-on-software') #('aps' 'application/mime') #('arc' 'application/octet-stream') #('arj' 'application/arj') #('arj' 'application/octet-stream') #('art' 'image/x-jg') #('asf' 'video/x-ms-asf') #('asm' 'text/x-asm') #('asp' 'text/asp') #('asx' 'application/x-mplayer2') #('asx' 'video/x-ms-asf') #('asx' 'video/x-ms-asf-plugin') #('au' 'audio/basic') #('au' 'audio/x-au') #('avi' 'application/x-troff-msvideo') #('avi' 'video/avi') #('avi' 'video/msvideo') #('avi' 'video/x-msvideo') #('avs' 'video/avs-video') #('bcpio' 'application/x-bcpio') #('bin' 'application/mac-binary') #('bin' 'application/macbinary') #('bin' 'application/octet-stream') #('bin' 'application/x-binary') #('bin' 'application/x-macbinary') #('bm' 'image/bmp') #('bmp' 'image/bmp') #('bmp' 'image/x-windows-bmp') #('boo' 'application/book') #('book' 'application/book') #('boz' 'application/x-bzip2') #('bsh' 'application/x-bsh') #('bz' 'application/x-bzip') #('bz2' 'application/x-bzip2') #('c' 'text/plain') #('c' 'text/x-c') #('c++' 'text/plain') #('cat' 'application/vndms-pkiseccat') #('cc' 'text/plain') #('cc' 'text/x-c') #('ccad' 'application/clariscad') #('cco' 'application/x-cocoa') #('cdf' 'application/cdf') #('cdf' 'application/x-cdf') #('cdf' 'application/x-netcdf') #('cer' 'application/pkix-cert') #('cer' 'application/x-x509-ca-cert') #('cha' 'application/x-chat') #('chat' 'application/x-chat') #('class' 'application/java') #('class' 'application/java-byte-code') #('class' 'application/x-java-class') #('com' 'application/octet-stream') #('com' 'text/plain') #('conf' 'text/plain') #('cpio' 'application/x-cpio') #('cpp' 'text/x-c') #('cpt' 'application/mac-compactpro') #('cpt' 'application/x-compactpro') #('cpt' 'application/x-cpt') #('crl' 'application/pkcs-crl') #('crl' 'application/pkix-crl') #('crt' 'application/pkix-cert') #('crt' 'application/x-x509-ca-cert') #('crt' 'application/x-x509-user-cert') #('csh' 'application/x-csh') #('csh' 'text/x-scriptcsh') #('css' 'application/x-pointplus') #('css' 'text/css') #('cxx' 'text/plain') #('dcr' 'application/x-director') #('deepv' 'application/x-deepv') #('def' 'text/plain') #('der' 'application/x-x509-ca-cert') #('dif' 'video/x-dv') #('dir' 'application/x-director') #('dl' 'video/dl') #('dl' 'video/x-dl') #('doc' 'application/msword') #('dot' 'application/msword') #('dp' 'application/commonground') #('drw' 'application/drafting') #('dump' 'application/octet-stream') #('dv' 'video/x-dv') #('dvi' 'application/x-dvi') #('dwf' '(old)') #('dwf' 'model/vnddwf') #('dwg' 'application/acad') #('dwg' 'image/vnddwg') #('dwg' 'image/x-dwg') #('dxf' 'application/dxf') #('dxf' 'image/vnddwg') #('dxf' 'image/x-dwg') #('dxr' 'application/x-director') #('el' 'text/x-scriptelisp') #('elc' 'ELisp)') #('elc' 'application/x-elc') #('env' 'application/x-envoy') #('eps' 'application/postscript') #('es' 'application/x-esrehber') #('etx' 'text/x-setext') #('evy' 'application/envoy') #('evy' 'application/x-envoy') #('exe' 'application/octet-stream') #('f' 'text/plain') #('f' 'text/x-fortran') #('f77' 'text/x-fortran') #('f90' 'text/plain') #('f90' 'text/x-fortran') #('fdf' 'application/vndfdf') #('fif' 'application/fractals') #('fif' 'image/fif') #('fli' 'video/fli') #('fli' 'video/x-fli') #('flo' 'image/florian') #('flx' 'text/vndfmiflexstor') #('fmf' 'video/x-atomic3d-feature') #('for' 'text/plain') #('for' 'text/x-fortran') #('fpx' 'image/vndfpx') #('fpx' 'image/vndnet-fpx') #('frl' 'application/freeloader') #('funk' 'audio/make') #('g' 'text/plain') #('g3' 'image/g3fax') #('gif' 'image/gif') #('gl' 'video/gl') #('gl' 'video/x-gl') #('gsd' 'audio/x-gsm') #('gsm' 'audio/x-gsm') #('gsp' 'application/x-gsp') #('gss' 'application/x-gss') #('gtar' 'application/x-gtar') #('gz' 'application/x-compressed') #('gz' 'application/x-gzip') #('gzip' 'application/x-gzip') #('gzip' 'multipart/x-gzip') #('h' 'text/plain') #('h' 'text/x-h') #('hdf' 'application/x-hdf') #('help' 'application/x-helpfile') #('hgl' 'application/vndhp-HPGL') #('hh' 'text/plain') #('hh' 'text/x-h') #('hlb' 'text/x-script') #('hlp' 'application/hlp') #('hlp' 'application/x-helpfile') #('hlp' 'application/x-winhelp') #('hpg' 'application/vndhp-HPGL') #('hpgl' 'application/vndhp-HPGL') #('hqx' 'application/binhex') #('hqx' 'application/binhex4') #('hqx' 'application/mac-binhex') #('hqx' 'application/mac-binhex40') #('hqx' 'application/x-binhex40') #('hqx' 'application/x-mac-binhex40') #('hta' 'application/hta') #('htc' 'text/x-component') #('htm' 'text/html') #('html' 'text/html') #('htmls' 'text/html') #('htt' 'text/webviewhtml') #('htx' 'text/html') #('ice' 'x-conference/x-cooltalk') #('ico' 'image/x-icon') #('idc' 'text/plain') #('ief' 'image/ief') #('iefs' 'image/ief') #('iges' 'application/iges') #('iges' 'model/iges') #('igs' 'application/iges') #('igs' 'model/iges') #('ima' 'application/x-ima') #('imap' 'application/x-httpd-imap') #('inf' 'application/inf') #('ins' 'application/x-internett-signup') #('ip' 'application/x-ip2') #('isu' 'video/x-isvideo') #('it' 'audio/it') #('iv' 'application/x-inventor') #('ivr' 'i-world/i-vrml') #('ivy' 'application/x-livescreen') #('jam' 'audio/x-jam') #('jav' 'text/plain') #('jav' 'text/x-java-source') #('java' 'text/plain') #('java' 'text/x-java-source') #('jcm' 'application/x-java-commerce') #('jfif' 'image/jpeg') #('jfif' 'image/pjpeg') #('jfif-tbnl' 'image/jpeg') #('jpe' 'image/jpeg') #('jpe' 'image/pjpeg') #('jpeg' 'image/jpeg') #('jpeg' 'image/pjpeg') #('jpg' 'image/jpeg') #('jpg' 'image/pjpeg') #('jps' 'image/x-jps') #('js' 'application/x-javascript') #('jut' 'image/jutvision') #('kar' 'audio/midi') #('kar' 'music/x-karaoke') #('ksh' 'application/x-ksh') #('ksh' 'text/x-scriptksh') #('la' 'audio/nspaudio') #('la' 'audio/x-nspaudio') #('lam' 'audio/x-liveaudio') #('latex' 'application/x-latex') #('lha' 'application/lha') #('lha' 'application/octet-stream') #('lha' 'application/x-lha') #('lhx' 'application/octet-stream') #('list' 'text/plain') #('lma' 'audio/nspaudio') #('lma' 'audio/x-nspaudio') #('log' 'text/plain') #('lsp' 'application/x-lisp') #('lsp' 'text/x-scriptlisp') #('lst' 'text/plain') #('lsx' 'text/x-la-asf') #('ltx' 'application/x-latex') #('lzh' 'application/octet-stream') #('lzh' 'application/x-lzh') #('lzx' 'application/lzx') #('lzx' 'application/octet-stream') #('lzx' 'application/x-lzx') #('m' 'text/plain') #('m' 'text/x-m') #('m1v' 'video/mpeg') #('m2a' 'audio/mpeg') #('m2v' 'video/mpeg') #('m3u' 'audio/x-mpequrl') #('man' 'application/x-troff-man') #('map' 'application/x-navimap') #('mar' 'text/plain') #('mbd' 'application/mbedlet') #('mc$' 'application/x-magic-cap-package-10') #('mcd' 'application/mcad') #('mcd' 'application/x-mathcad') #('mcf' 'image/vasa') #('mcf' 'text/mcf') #('mcp' 'application/netmc') #('me' 'application/x-troff-me') #('mht' 'message/rfc822') #('mhtml' 'message/rfc822') #('mid' 'application/x-midi') #('mid' 'audio/midi') #('mid' 'audio/x-mid') #('mid' 'audio/x-midi') #('mid' 'music/crescendo') #('mid' 'x-music/x-midi') #('midi' 'application/x-midi') #('midi' 'audio/midi') #('midi' 'audio/x-mid') #('midi' 'audio/x-midi') #('midi' 'music/crescendo') #('midi' 'x-music/x-midi') #('mif' 'application/x-frame') #('mif' 'application/x-mif') #('mime' 'message/rfc822') #('mime' 'www/mime') #('mjf' 'audio/x-vndAudioExplosionMjuiceMediaFile') #('mjpg' 'video/x-motion-jpeg') #('mm' 'application/base64') #('mm' 'application/x-meme') #('mme' 'application/base64') #('mod' 'audio/mod') #('mod' 'audio/x-mod') #('moov' 'video/quicktime') #('mov' 'video/quicktime') #('movie' 'video/x-sgi-movie') #('mp2' 'audio/mpeg') #('mp2' 'audio/x-mpeg') #('mp2' 'video/mpeg') #('mp2' 'video/x-mpeg') #('mp2' 'video/x-mpeq2a') #('mp3' 'audio/mpeg3') #('mp3' 'audio/x-mpeg-3') #('mp3' 'video/mpeg') #('mp3' 'video/x-mpeg') #('mpa' 'audio/mpeg') #('mpa' 'video/mpeg') #('mpc' 'application/x-project') #('mpe' 'video/mpeg') #('mpeg' 'video/mpeg') #('mpg' 'audio/mpeg') #('mpg' 'video/mpeg') #('mpga' 'audio/mpeg') #('mpp' 'application/vndms-project') #('mpt' 'application/x-project') #('mpv' 'application/x-project') #('mpx' 'application/x-project') #('mrc' 'application/marc') #('ms' 'application/x-troff-ms') #('mv' 'video/x-sgi-movie') #('my' 'audio/make') #('mzz' 'application/x-vndAudioExplosionmzz') #('nap' 'image/naplps') #('naplps' 'image/naplps') #('nc' 'application/x-netcdf') #('ncm' 'application/vndnokiaconfiguration-message') #('nif' 'image/x-niff') #('niff' 'image/x-niff') #('nix' 'application/x-mix-transfer') #('nsc' 'application/x-conference') #('nvd' 'application/x-navidoc') #('o' 'application/octet-stream') #('oda' 'application/oda') #('omc' 'application/x-omc') #('omcd' 'application/x-omcdatamaker') #('omcr' 'application/x-omcregerator') #('p' 'text/x-pascal') #('p10' 'application/pkcs10') #('p10' 'application/x-pkcs10') #('p12' 'application/pkcs-12') #('p12' 'application/x-pkcs12') #('p7a' 'application/x-pkcs7-signature') #('p7c' 'application/pkcs7-mime') #('p7c' 'application/x-pkcs7-mime') #('p7m' 'application/pkcs7-mime') #('p7m' 'application/x-pkcs7-mime') #('p7r' 'application/x-pkcs7-certreqresp') #('p7s' 'application/pkcs7-signature') #('part' 'application/pro_eng') #('pas' 'text/pascal') #('pbm' 'image/x-portable-bitmap') #('pcl' 'application/vndhp-PCL') #('pcl' 'application/x-pcl') #('pct' 'image/x-pict') #('pcx' 'image/x-pcx') #('pdb' 'chemical/x-pdb') #('pdf' 'application/pdf') #('pfunk' 'audio/make') #('pfunk' 'audio/makemyfunk') #('pgm' 'image/x-portable-graymap') #('pgm' 'image/x-portable-greymap') #('pic' 'image/pict') #('pict' 'image/pict') #('pkg' 'application/x-newton-compatible-pkg') #('pko' 'application/vndms-pkipko') #('pl' 'text/plain') #('pl' 'text/x-scriptperl') #('plx' 'application/x-PiXCLscript') #('pm' 'image/x-xpixmap') #('pm' 'text/x-scriptperl-module') #('pm4' 'application/x-pagemaker') #('pm5' 'application/x-pagemaker') #('png' 'image/png') #('pnm' 'application/x-portable-anymap') #('pnm' 'image/x-portable-anymap') #('pot' 'application/mspowerpoint') #('pot' 'application/vndms-powerpoint') #('pov' 'model/x-pov') #('ppa' 'application/vndms-powerpoint') #('ppm' 'image/x-portable-pixmap') #('pps' 'application/mspowerpoint') #('pps' 'application/vndms-powerpoint') #('ppt' 'application/mspowerpoint') #('ppt' 'application/powerpoint') #('ppt' 'application/vndms-powerpoint') #('ppt' 'application/x-mspowerpoint') #('ppz' 'application/mspowerpoint') #('pre' 'application/x-freelance') #('prt' 'application/pro_eng') #('ps' 'application/postscript') #('psd' 'application/octet-stream') #('pvu' 'paleovu/x-pv') #('pwz' 'application/vndms-powerpoint') #('py' 'text/x-scriptphyton') #('pyc' 'applicaiton/x-bytecodepython') #('qcp' 'audio/vndqcelp') #('qd3' 'x-world/x-3dmf') #('qd3d' 'x-world/x-3dmf') #('qif' 'image/x-quicktime') #('qt' 'video/quicktime') #('qtc' 'video/x-qtc') #('qti' 'image/x-quicktime') #('qtif' 'image/x-quicktime') #('ra' 'audio/x-pn-realaudio') #('ra' 'audio/x-pn-realaudio-plugin') #('ra' 'audio/x-realaudio') #('ram' 'audio/x-pn-realaudio') #('ras' 'application/x-cmu-raster') #('ras' 'image/cmu-raster') #('ras' 'image/x-cmu-raster') #('rast' 'image/cmu-raster') #('rexx' 'text/x-scriptrexx') #('rf' 'image/vndrn-realflash') #('rgb' 'image/x-rgb') #('rm' 'application/vndrn-realmedia') #('rm' 'audio/x-pn-realaudio') #('rmi' 'audio/mid') #('rmm' 'audio/x-pn-realaudio') #('rmp' 'audio/x-pn-realaudio') #('rmp' 'audio/x-pn-realaudio-plugin') #('rng' 'application/ringing-tones') #('rng' 'application/vndnokiaringing-tone') #('rnx' 'application/vndrn-realplayer') #('roff' 'application/x-troff') #('rp' 'image/vndrn-realpix') #('rpm' 'audio/x-pn-realaudio-plugin') #('rt' 'text/richtext') #('rt' 'text/vndrn-realtext') #('rtf' 'application/rtf') #('rtf' 'application/x-rtf') #('rtf' 'text/richtext') #('rtx' 'application/rtf') #('rtx' 'text/richtext') #('rv' 'video/vndrn-realvideo') #('s' 'text/x-asm') #('s3m' 'audio/s3m') #('saveme' 'application/octet-stream') #('sbk' 'application/x-tbook') #('scm' 'application/x-lotusscreencam') #('scm' 'text/x-scriptguile') #('scm' 'text/x-scriptscheme') #('scm' 'video/x-scm') #('sdml' 'text/plain') #('sdp' 'application/sdp') #('sdp' 'application/x-sdp') #('sdr' 'application/sounder') #('sea' 'application/sea') #('sea' 'application/x-sea') #('set' 'application/set') #('sgm' 'text/sgml') #('sgm' 'text/x-sgml') #('sgml' 'text/sgml') #('sgml' 'text/x-sgml') #('sh' 'application/x-bsh') #('sh' 'application/x-sh') #('sh' 'application/x-shar') #('sh' 'text/x-scriptsh') #('shar' 'application/x-bsh') #('shar' 'application/x-shar') #('shtml' 'text/html') #('shtml' 'text/x-server-parsed-html') #('sid' 'audio/x-psid') #('sit' 'application/x-sit') #('sit' 'application/x-stuffit') #('skd' 'application/x-koan') #('skm' 'application/x-koan') #('skp' 'application/x-koan') #('skt' 'application/x-koan') #('sl' 'application/x-seelogo') #('smi' 'application/smil') #('smil' 'application/smil') #('snd' 'audio/basic') #('snd' 'audio/x-adpcm') #('sol' 'application/solids') #('spc' 'application/x-pkcs7-certificates') #('spc' 'text/x-speech') #('spl' 'application/futuresplash') #('spr' 'application/x-sprite') #('sprite' 'application/x-sprite') #('src' 'application/x-wais-source') #('ssi' 'text/x-server-parsed-html') #('ssm' 'application/streamingmedia') #('sst' 'application/vndms-pkicertstore') #('step' 'application/step') #('stl' 'application/sla') #('stl' 'application/vndms-pkistl') #('stl' 'application/x-navistyle') #('stp' 'application/step') #('sv4cpio' 'application/x-sv4cpio') #('sv4crc' 'application/x-sv4crc') #('svf' 'image/vnddwg') #('svf' 'image/x-dwg') #('svr' 'application/x-world') #('svr' 'x-world/x-svr') #('swf' 'application/x-shockwave-flash') #('t' 'application/x-troff') #('talk' 'text/x-speech') #('tar' 'application/x-tar') #('tbk' 'application/toolbook') #('tbk' 'application/x-tbook') #('tcl' 'application/x-tcl') #('tcl' 'text/x-scripttcl') #('tcsh' 'text/x-scripttcsh') #('tex' 'application/x-tex') #('texi' 'application/x-texinfo') #('texinfo' 'application/x-texinfo') #('text' 'application/plain') #('text' 'text/plain') #('tgz' 'application/gnutar') #('tgz' 'application/x-compressed') #('tif' 'image/tiff') #('tif' 'image/x-tiff') #('tiff' 'image/tiff') #('tiff' 'image/x-tiff') #('tr' 'application/x-troff') #('tsi' 'audio/tsp-audio') #('tsp' 'application/dsptype') #('tsp' 'audio/tsplayer') #('tsv' 'text/tab-separated-values') #('turbot' 'image/florian') #('txt' 'text/plain') #('uil' 'text/x-uil') #('uni' 'text/uri-list') #('unis' 'text/uri-list') #('unv' 'application/i-deas') #('uri' 'text/uri-list') #('uris' 'text/uri-list') #('ustar' 'application/x-ustar') #('ustar' 'multipart/x-ustar') #('uu' 'application/octet-stream') #('uu' 'text/x-uuencode') #('uue' 'text/x-uuencode') #('vcd' 'application/x-cdlink') #('vcs' 'text/x-vCalendar') #('vda' 'application/vda') #('vdo' 'video/vdo') #('vew' 'application/groupwise') #('viv' 'video/vivo') #('viv' 'video/vndvivo') #('vivo' 'video/vivo') #('vivo' 'video/vndvivo') #('vmd' 'application/vocaltec-media-desc') #('vmf' 'application/vocaltec-media-file') #('voc' 'audio/voc') #('voc' 'audio/x-voc') #('vos' 'video/vosaic') #('vox' 'audio/voxware') #('vqe' 'audio/x-twinvq-plugin') #('vqf' 'audio/x-twinvq') #('vql' 'audio/x-twinvq-plugin') #('vrml' 'application/x-vrml') #('vrml' 'model/vrml') #('vrml' 'x-world/x-vrml') #('vrt' 'x-world/x-vrt') #('vsd' 'application/x-visio') #('vst' 'application/x-visio') #('vsw' 'application/x-visio') #('w60' 'application/wordperfect60') #('w61' 'application/wordperfect61') #('w6w' 'application/msword') #('wav' 'audio/wav') #('wav' 'audio/x-wav') #('wb1' 'application/x-qpro') #('wbmp' 'image/vndwapwbmp') #('web' 'application/vndxara') #('wiz' 'application/msword') #('wk1' 'application/x-123') #('wmf' 'windows/metafile') #('wml' 'text/vndwapwml') #('wmlc' 'application/vndwapwmlc') #('wmls' 'text/vndwapwmlscript') #('wmlsc' 'application/vndwapwmlscriptc') #('word' 'application/msword') #('wp' 'application/wordperfect') #('wp5' 'application/wordperfect') #('wp5' 'application/wordperfect60') #('wp6' 'application/wordperfect') #('wpd' 'application/wordperfect') #('wpd' 'application/x-wpwin') #('wq1' 'application/x-lotus') #('wri' 'application/mswrite') #('wri' 'application/x-wri') #('wrl' 'application/x-world') #('wrl' 'model/vrml') #('wrl' 'x-world/x-vrml') #('wrz' 'model/vrml') #('wrz' 'x-world/x-vrml') #('wsc' 'text/scriplet') #('wsrc' 'application/x-wais-source') #('wtk' 'application/x-wintalk') #('xbm' 'image/x-xbitmap') #('xbm' 'image/x-xbm') #('xbm' 'image/xbm') #('xdr' 'video/x-amt-demorun') #('xgz' 'xgl/drawing') #('xif' 'image/vndxiff') #('xl' 'application/excel') #('xla' 'application/excel') #('xla' 'application/x-excel') #('xla' 'application/x-msexcel') #('xlb' 'application/excel') #('xlb' 'application/vndms-excel') #('xlb' 'application/x-excel') #('xlc' 'application/excel') #('xlc' 'application/vndms-excel') #('xlc' 'application/x-excel') #('xld' 'application/excel') #('xld' 'application/x-excel') #('xlk' 'application/excel') #('xlk' 'application/x-excel') #('xll' 'application/excel') #('xll' 'application/vndms-excel') #('xll' 'application/x-excel') #('xlm' 'application/excel') #('xlm' 'application/vndms-excel') #('xlm' 'application/x-excel') #('xls' 'application/excel') #('xls' 'application/vndms-excel') #('xls' 'application/x-excel') #('xls' 'application/x-msexcel') #('xlt' 'application/excel') #('xlt' 'application/x-excel') #('xlv' 'application/excel') #('xlv' 'application/x-excel') #('xlw' 'application/excel') #('xlw' 'application/vndms-excel') #('xlw' 'application/x-excel') #('xlw' 'application/x-msexcel') #('xm' 'audio/xm') #('xml' 'application/xml') #('xml' 'text/xml') #('xmz' 'xgl/movie') #('xpix' 'application/x-vndls-xpix') #('xpm' 'image/x-xpixmap') #('xpm' 'image/xpm') #('x-png' 'image/png') #('xsr' 'video/x-amt-showrun') #('xwd' 'image/x-xwd') #('xwd' 'image/x-xwindowdump') #('xyz' 'chemical/x-pdb') #('z' 'application/x-compress') #('z' 'application/x-compressed') #('zip' 'application/x-compressed') #('zip' 'application/x-zip-compressed') #('zip' 'application/zip') #('zip' 'multipart/x-zip') #('zoo' 'application/octet-stream') #('zsh' 'text/x-scriptzsh') #('jsp' 'text/html') #('ssp' 'text/html') )
defaultMimeTypes "List of MIME content types. The second item defines whether or not this type will be considered as a binary type" ^#( #('application/octet-stream' 1) #('application/postscript' 1) #('application/oda' 1) #('application/atomicmail' 1) #('application/andrew-inset' 1) #('application/slate' 1) #('application/wita' 1) #('application/dec-dx' 1) #('application/dca-rft' 1) #('application/activemessage' 1) #('application/rtf' 1) #('application/applefile' 1) #('application/mac-binhex40' 1) #('application/news-message-id' 1) #('application/news-transmission' 1) #('application/wordperfect5.1' 1) #('application/pdf' 1 #(#encoding 'base64')) #('application/zip' 1) #('application/macwriteii' 1) #('application/msword' 1) #('application/remote-printing' 1) #('application/mathematica' 1) #('application/cybercash' 1) #('application/commonground' 1) #('application/iges' 1) #('application/riscos' 1) #('application/eshop' 1) #('application/x400-bp' 1) #('application/sgml' 1) #('application/cals-1840' 1) #('application/pgp-encrypted' 1) #('application/pgp-signature' 1) #('application/pgp-keys' 1) #('application/vnd.framemaker' 1) #('application/vnd.mif' 1) #('application/vnd.ms-excel' 1) #('application/vnd.ms-powerpoint' 1) #('application/vnd.ms-project' 1) #('application/vnd.ms-works' 1) #('application/vnd.ms-tnef' 1) #('application/vnd.svd' 1) #('application/vnd.music-niff' 1) #('application/vnd.ms-artgalry' 1) #('application/vnd.truedoc' 1) #('application/vnd.koan' 1) #('application/vnd.street-stream' 1) #('application/vnd.fdf' 1) #('application/set-payment-initiation' 1) #('application/set-payment' 1) #('application/set-registration-initiation' 1) #('application/set-registration' 1) #('application/vnd.seemail' 1) #('application/vnd.businessobjects' 1) #('application/vnd.meridian-slingshot' 1) #('application/vnd.xara' 1) #('application/sgml-open-catalog' 1) #('application/vnd.rapid' 1) #('application/vnd.enliven' 1) #('application/vnd.japannet-registration-wakeup' 1) #('application/vnd.japannet-verification-wakeup' 1) #('application/vnd.japannet-payment-wakeup' 1) #('application/vnd.japannet-directory-service' 1) #('application/vnd.intertrust.digibox' 1) #('application/vnd.intertrust.nncp' 1) #('application/prs.alvestrand.titrax-sheet' 1) #('application/vnd.noblenet-web' 1) #('application/vnd.noblenet-sealer' 1) #('application/vnd.noblenet-directory' 1) #('application/prs.nprend' 1) #('application/vnd.webturbo' 1) #('application/hyperstudio' 1) #('application/vnd.shana.informed.formtemplate' 1) #('application/vnd.shana.informed.formdata' 1) #('application/vnd.shana.informed.package' 1) #('application/vnd.shana.informed.interchange' 1) #('application/vnd.$commerce_battelle' 1) #('application/vnd.osa.netdeploy' 1) #('application/vnd.ibm.MiniPay' 1) #('application/vnd.japannet-jpnstore-wakeup' 1) #('application/vnd.japannet-setstore-wakeup' 1) #('application/vnd.japannet-verification' 1) #('application/vnd.japannet-registration' 1) #('application/vnd.hp-HPGL' 1) #('application/vnd.hp-PCL' 1) #('application/vnd.hp-PCLXL' 1) #('application/vnd.musician' 1) #('application/vnd.FloGraphIt' 1) #('application/vnd.intercon.formnet' 1) #('application/vemmi' 1) #('application/vnd.ms-asf' 1) #('application/vnd.ecdis-update' 1) #('application/vnd.powerbuilder6' 1) #('application/vnd.powerbuilder6-s' 1) #('application/vnd.lotus-wordpro' 1) #('application/vnd.lotus-approach' 1) #('application/vnd.lotus-1-2-3' 1) #('application/vnd.lotus-organizer' 1) #('application/vnd.lotus-screencam' 1) #('application/vnd.lotus-freelance' 1) #('application/vnd.fujitsu.oasys' 1) #('application/vnd.fujitsu.oasys2' 1) #('application/vnd.swiftview-ics' 1) #('application/vnd.dna' 1) #('application/prs.cww' 1) #('application/vnd.wt.stf' 1) #('application/vnd.dxr' 1) #('application/vnd.mitsubishi.misty-guard.trustweb' 1) #('application/vnd.ibm.modcap' 1) #('application/vnd.acucobol' 1) #('application/vnd.fujitsu.oasys3' 1) #('application/marc' 1) #('application/vnd.fujitsu.oasysprs' 1) #('application/vnd.fujitsu.oasysgp' 1) #('application/vnd.visio' 1) #('application/vnd.netfpx' 1) #('application/vnd.audiograph' 1) #('application/vnd.epson.salt' 1) #('application/vnd.3M.Post-it-Notes' 1) #('application/vnd.novadigm.EDX' 1) #('application/vnd.novadigm.EXT' 1) #('application/vnd.novadigm.EDM' 1) #('application/vnd.claymore' 1) #('application/vnd.comsocaller' 1) #('application/pkcs7-mime' 1) #('application/pkcs7-signature' 1) #('application/pkcs10' 1) #('application/vnd.yellowriver-custom-menu' 1) #('application/vnd.ecowin.chart' 1) #('application/vnd.ecowin.series' 1) #('application/vnd.ecowin.filerequest' 1) #('application/vnd.ecowin.fileupdate' 1) #('application/vnd.ecowin.seriesrequest' 1) #('application/vnd.ecowin.seriesupdate' 1) #('application/EDIFACT' 1) #('application/EDI-X12' 1) #('application/EDI-Consent' 1) #('application/vnd.wrq-hp3000-labelled' 1) #('application/vnd.minisoft-hp3000-save' 1) #('application/vnd.ffsns' 1) #('application/vnd.hp-hps' 1) #('application/vnd.fujixerox.docuworks' 1) #('application/xml' 1) #('application/vnd.anser-web-funds-transfer-initiation' 1) #('application/vnd.anser-web-certificate-issue-initiation' 1) #('application/vnd.is-xpr' 1) #('application/vnd.intu.qbo' 1) #('application/vnd.publishare-delta-tree' 1) #('application/vnd.cybank' 1) #('application/batch-SMTP' 1) #('application/vnd.uplanet.alert' 1) #('application/vnd.uplanet.cacheop' 1) #('application/vnd.uplanet.list' 1) #('application/vnd.uplanet.listcmd' 1) #('application/vnd.uplanet.channel' 1) #('application/vnd.uplanet.bearer-choice' 1) #('application/vnd.uplanet.signal' 1) #('application/vnd.uplanet.alert-wbxml' 1) #('application/vnd.uplanet.cacheop-wbmxl' 1) #('application/vnd.uplanet.list-wbxml' 1) #('application/vnd.uplanet.listcmd-wbxml' 1) #('application/vnd.uplanet.channel-wbxml' 1) #('application/vnd.uplanet.bearer-choice-wbxml' 1) #('application/vnd.epson.quickanime' 1) #('application/vnd.commonspace' 1) #('application/vnd.fut-misnet' 1) #('application/vnd.xfdl' 1) #('application/vnd.intu.qfx' 1) #('application/vnd.epson.ssf' 1) #('application/vnd.epson.msf' 1) #('application/vnd.powerbuilder7' 1) #('application/vnd.powerbuilder7-s' 1) #('application/vnd.lotus-notes' 1) #('application/pkixcmp' 1) #('application/vnd.wap.wmlc' 1) #('application/vnd.wap.wmlscriptc' 1) #('application/vnd.motorola.flexsuite' 1) #('application/vnd.wap.wbxml' 1) #('application/vnd.motorola.flexsuite.wem' 1) #('application/vnd.motorola.flexsuite.kmr' 1) #('application/vnd.motorola.flexsuite.adsi' 1) #('application/vnd.motorola.flexsuite.fis' 1) #('application/vnd.motorola.flexsuite.gotap' 1) #('application/vnd.motorola.flexsuite.ttc' 1) #('application/vnd.ufdl' 1) #('application/vnd.accpac.simply.imp' 1) #('application/vnd.accpac.simply.aso' 1) #('application/vnd.vcx' 1) #('application/ipp' 1) #('application/ocsp-request' 1) #('application/ocsp-response' 1) #('application/vnd.previewsystems.box' 1) #('application/vnd.mediastation.cdkey' 1) #('application/vnd.pg.format' 1) #('application/vnd.pg.osasli' 1) #('application/vnd.hp-hpid' 1) #('application/pkix-cert' 1) #('application/pkix-crl' 1) #('application/vnd.Mobius.TXF' 1) #('application/vnd.Mobius.PLC' 1) #('application/vnd.Mobius.DIS' 1) #('application/vnd.Mobius.DAF' 1) #('application/vnd.Mobius.MSL' 1) #('application/vnd.cups-raster' 1) #('application/vnd.cups-postscript' 1) #('application/vnd.cups-raw' 1) #('application/index' 1) #('application/index.cmd' 1) #('application/index.response' 1) #('application/index.obj' 1) #('application/index.vnd' 1) #('application/vnd.triscape.mxs' 1) #('application/vnd.powerbuilder75' 1) #('application/vnd.powerbuilder75-s' 1) #('application/vnd.dpgraph' 1) #('application/http' 0) #('application/sdp' 1) #('application/vnd.eudora.data' 1) #('application/vnd.fujixerox.docuworks.binder' 1) #('application/vnd.vectorworks' 1) #('application/vnd.grafeq' 1) #('application/vnd.bmi' 1) #('application/vnd.ericsson.quickcall' 1) #('application/vnd.hzn-3d-crossword' 1) #('application/vnd.wap.slc' 1) #('application/vnd.wap.sic' 1) #('application/vnd.groove-injector' 1) #('application/vnd.fujixerox.ddd' 1) #('application/vnd.groove-account' 1) #('application/vnd.groove-identity-message' 1) #('application/vnd.groove-tool-message' 1) #('application/vnd.groove-tool-template' 1) #('application/vnd.groove-vcard' 1) #('application/vnd.ctc-posml' 1) #('application/vnd.canon-lips' 1) #('application/vnd.canon-cpdl' 1) #('application/vnd.trueapp' 1) #('application/vnd.s3sms' 1) #('application/iotp' 1) #('application/vnd.mcd' 1) #('application/vnd.httphone' 1) #('application/vnd.informix-visionary' 1) #('application/vnd.msign' 1) #('application/vnd.ms-lrm' 1) #('application/vnd.contact.cmsg' 1) #('application/vnd.epson.esf' 1) #('application/whoispp-query' 1) #('application/whoispp-response' 1) #('application/vnd.mozilla.xul+xml' 1) #('application/parityfec' 1) #('application/vnd.palm' 1) #('application/vnd.fsc.weblaunch' 1) #('application/vnd.tve-trigger' 1) #('application/dvcs' 1) #('application/sieve' 1) #('application/vnd.vividence.scriptfile' 1) #('application/ms-word-document' 1) #('application/mac-binhex40' 1) #('application/mac-compactpro' 1) #('application/x-gtar' 1) #('application/x-shockwave-flash' 1) #('application/x-stuffit' 1) #('application/x-tar' 1) #('audio/basic' 1) #('audio/32kadpcm' 1) #('audio/vnd.qcelp' 1) #('audio/vnd.digital-winds' 1) #('audio/vnd.lucent.voice' 1) #('audio/vnd.octel.sbc' 1) #('audio/vnd.rhetorex.32kadpcm' 1) #('audio/vnd.vmx.cvsd' 1) #('audio/vnd.nortel.vbk' 1) #('audio/vnd.cns.anp1' 1) #('audio/vnd.cns.inf1' 1) #('audio/L16' 1) #('audio/vnd.everad.plj' 1) #('audio/telephone-event' 1) #('audio/tone' 1) #('audio/prs.sid' 1) #('audio/vnd.nuera.ecelp4800' 1) #('audio/vnd.nuera.ecelp7470' 1) #('audio/mpeg' 1) #('audio/parityfec' 1) #('audio/MP4A-LATM' 1) #('audio/midi' 1) #('audio/x-aiff' 1) #('audio/x-pn-realaudio' 1) #('audio/x-pn-realaudio' 1) #('audio/x-pn-realaudio-plugin' 1) #('audio/x-realaudio' 1) #('audio/x-wav' 1) #('image/jpeg' 1) #('image/gif' 1) #('image/ief' 1) #('image/g3fax' 1) #('image/tiff' 1) #('image/cgm' 1) #('image/naplps' 1) #('image/vnd.dwg' 1) #('image/vnd.svf' 1) #('image/vnd.dxf' 1) #('image/png' 1) #('image/vnd.fpx' 1) #('image/vnd.net-fpx' 1) #('image/vnd.xiff' 1) #('image/prs.btif' 1) #('image/vnd.fastbidsheet' 1) #('image/vnd.wap.wbmp' 1) #('image/prs.pti' 1) #('image/vnd.cns.inf2' 1) #('image/vnd.mix' 1) #('image/vnd.fujixerox.edmics-rlc' 1) #('image/vnd.fujixerox.edmics-mmr' 1) #('image/vnd.fst' 1) #('image/x-xbitmap' 1) #('message/delivery-status' 0) #('message/external-body' 0) #('message/htpp' 0) #('message/news' 0) #('message/partial' 0) #('message/rfc822' 0) #('message/s-http' 0) #('multipart/mixed' 0) #('multipart/alternative' 0) #('multipart/digest' 0) #('multipart/parallel' 0) #('multipart/appledouble' 0) #('multipart/header-set' 0) #('multipart/form-data' 0) #('multipart/related' 0) #('multipart/report' 0) #('multipart/voice-message' 0) #('multipart/signed' 0) #('multipart/encrypted' 0) #('multipart/byteranges' 0) #('text/plain' 0) #('text/richtext' 0) #('text/enriched' 0) #('text/tab-separated-values' 0) #('text/html' 0) #('text/sgml' 0) #('text/vnd.latex-z' 0) #('text/vnd.fmi.flexstor' 0) #('text/uri-list' 0) #('text/vnd.abc' 0) #('text/rfc822-headers' 0) #('text/vnd.in3d.3dml' 0) #('text/prs.lines.tag' 0) #('text/vnd.in3d.spot' 0) #('text/css' 0) #('text/xml' 0 #(#lineEndConvention 2)) #('text/rtf' 0) #('text/directory' 0) #('text/calendar' 0) #('text/vnd.wap.wml' 0) #('text/vnd.wap.wmlscript' 0) #('text/vnd.motorola.reflex' 0) #('text/vnd.fly' 0) #('text/vnd.wap.sl' 0) #('text/vnd.wap.si' 0) #('text/t140' 0) #('text/vnd.ms-mediapackage' 0) #('text/vnd.IPTC.NewsML' 0) #('text/vnd.IPTC.NITF' 0) #('text/vnd.curl' 0) #('text/vnd.DMClientScript' 0) #('text/parityfec' 0) #('video/mpeg' 1) #('video/quicktime' 1) #('video/vnd.vivo' 1) #('video/vnd.motorola.video' 1) #('video/vnd.motorola.videop' 1) #('video/vnd.fvt' 1) #('video/pointer' 1) #('video/parityfec' 1) #('video/vnd.mpegurl' 1) #('video/MP4V-ES' 1) #('video/x-msvideo' 1) #('video/x-sgi-movie' 1) #('model/iges' 1) #('model/vrml' 1) #('model/mesh' 1) #('model/vnd.dwf' 1) #('model/vnd.gtw' 1) #('model/vnd.flatland.3dml' 1) #('model/vnd.vtu' 1) #('model/vnd.mts' 1) #('model/vnd.gdl' 1) #('model/vnd.gs-gdl' 1) #('model/vnd.parasolid.transmit.text' 1) #('model/vnd.parasolid.transmit.binary' 1) )
initialize " MimeTypeDescriptor initialize " self initializeMimeTypes; initializeFileExtensionToMimeTypeMap; initializeMimeCharsetToEncodingMap
initializeFileExtensionToMimeTypeMap FileExtensionToMimeTypeMap := Dictionary new: 32. self defaultFileExtensionMap do: [ :element | FileExtensionToMimeTypeMap at: element first put: element last]. FileExtensionToMimeTypeMap at: 'html' put: 'text/html'; at: 'htm' put: 'text/html'; at: 'xml' put: 'text/xml'; at: 'txt' put: 'text/plain'; at: 'c' put: 'text/plain'; at: 'cpp' put: 'text/plain'; at: 'h' put: 'text/plain'; at: 'hpp' put: 'text/plain'; at: 'st' put: 'text/plain'; at: 'pst' put: 'text/plain'; at: 'cls' put: 'text/plain'; at: 'gif' put: 'image/gif'; at: 'jpg' put: 'image/jpeg'; at: 'jpeg' put: 'image/jpeg'; at: 'xbm' put: 'image/x-xbitmap'; at: 'mid' put: 'audio/midi'; at: 'doc' put: 'application/ms-word-document'; at: 'hqx' put: 'application/mac-binhex40'; at: 'cpt' put: 'application/mac-compactpro'; at: 'pdf' put: 'application/pdf'; at: 'ps' put: 'application/postscript'; at: 'ai' put: 'application/postscript'; at: 'eps' put: 'application/postscript'; at: 'rtf' put: 'text/rtf'; at: 'bin' put: 'application/octet-stream'; at: 'dms' put: 'application/octet-stream'; at: 'lha' put: 'application/octet-stream'; at: 'lzh' put: 'application/octet-stream'; at: 'exe' put: 'application/octet-stream'; at: 'class' put: 'application/octet-stream'; at: 'pcl' put: 'application/octet-stream'; at: 'im' put: 'application/octet-stream'; at: 'img' put: 'application/octet-stream'; at: 'zip' put: 'application/zip'; at: 'gz' put: 'application/gzip'; at: 'gtar' put: 'application/x-gtar'; at: 'swf' put: 'application/x-shockwave-flash'; at: 'sit' put: 'application/x-stuffit'; at: 'tar' put: 'application/x-tar'; at: 'au' put: 'audio/basic'; at: 'snd' put: 'audio/basic'; at: 'mid' put: 'audio/midi'; at: 'midi' put: 'audio/midi'; at: 'mpga' put: 'audio/mpeg'; at: 'mp2' put: 'audio/mpeg'; at: 'mp3' put: 'audio/mpeg'; at: 'aiff' put: 'audio/x-aiff'; at: 'aif' put: 'audio/x-aiff'; at: 'aifc' put: 'audio/x-aiff'; at: 'rm' put: 'audio/x-pn-realaudio'; at: 'ram' put: 'audio/x-pn-realaudio'; at: 'rpm' put: 'audio/x-pn-realaudio-plugin'; at: 'ra' put: 'audio/x-realaudio'; at: 'wav' put: 'audio/x-wav'; at: 'css' put: 'text/css'; at: 'mpeg' put: 'video/mpeg'; at: 'mpg' put: 'video/mpeg'; at: 'mpe' put: 'video/mpeg'; at: 'qt' put: 'video/quicktime'; at: 'mov' put: 'video/quicktime'; at: 'avi' put: 'video/x-msvideo'; at: 'movie' put: 'video/x-sgi-movie'.
initializeMimeCharsetToEncodingMap MimeCharsetToEncodingMap := IdentityDictionary new: 5. #( #(us-ascii ISO8859_1"ASCII") #(default ISO8859_1"ASCII") #('iso-8859-1' ISO8859_1) #(binary binary) ) do: [ :arr | MimeCharsetToEncodingMap at: arr first asSymbol put: arr last asSymbol ]
initializeMimeTypes | contentType entity token binary | MimeTypeRegistry := Dictionary new: 32. self defaultMimeTypes do: [ :literalArray | entity := MimeTypeDescriptor new. contentType := literalArray at: 1. entity contentType: contentType. binary := (literalArray at: 2) = 1. entity binary: binary. 3 to: literalArray size do: [ :idx | token := literalArray at: idx. (token isKindOf: Array) ifTrue: [entity propertyAt: token first put: token last]]. MimeTypeRegistry at: contentType put: entity].
</methods> <methods> Net.MimeTypeDescriptor class <category>Mime character sets</category>
defaultCharacterSet " Answer default character set that we use " " #todo. Rework because we may use different character sets on different platforms " ^self iso8859x1
defaultEncoding " Answer default character encoding that we use " ^self encodingForCharset: self defaultCharacterSet
defaultMimeCharacterSet " Default character set if none is specified " ^self usAscii
encodingForCharset: aCharsetName " MimeTypeDescriptor encodingForCharset: #us-ascii MimeTypeDescriptor encodingForCharset: 'ISO-8859-1' " ^MimeCharsetToEncodingMap at: aCharsetName asLowercase asSymbol ifAbsent: [ self encodingForCharset: #default ]
iso8859x1 ^'iso-8859-1'
iso8859x1Encoding ^self encodingForCharset: self iso8859x1
usAscii " Default canonical character set for Mime messages " ^'us-ascii'
usAsciiEncoding " Encoding name for us-ascii charset " ^self encodingForCharset: self usAscii
</methods> <methods> Net.MimeTypeDescriptor class <category>private</category>
guessFromExtension: aString "guesses a content type from the extension" ^self guessFromExtension: aString ifAbsent: [self defaultUnsupportedContentType].
guessFromExtension: aString ifAbsent: aBlock "Guesses a content type from the extension. aString represents a file extension. Possible values: '.xxx', 'xxx', nil." | ext | aString isNil ifTrue: [^aBlock value]. ext := aString first == $. ifTrue: [ aString copyFrom: 2 to: aString size ] ifFalse: [ aString ]. ^ FileExtensionToMimeTypeMap at: ext asLowercase ifAbsent: aBlock.
</methods> <methods> Net.NetNotification <category>private - actions</category>
defaultAction (self class logToTranscript and: [self defaultResumeValue notNil]) ifTrue: [Transcript cr; show:'<', self class fullName , '> ', self defaultResumeValue printString ]. ^self defaultResumeValue
</methods> <methods> Net.NetNotification class <category>accessing</category>
logToTranscript ^LogToTranscript
logToTranscript: aBoolean LogToTranscript := aBoolean
</methods> <methods> Net.UnsupportedCharacterReplacement <category>private</category>
defaultResumeValue ^0
</methods> <methods> Net.UnsupportedCharacterReplacement <category>private - actions</category>
defaultAction | s | self class logToTranscript ifTrue: [ s := (#WillBeReplacedBy << #net >> ' will be replaced by ') asString. Transcript cr; show:'<', self class fullName , '> ', self parameter printString, s, self defaultResumeValue printString ]. ^self defaultResumeValue
</methods> <methods> Net.SimpleScanner <category>stream interface -- reading</category>
atEnd ^source atEnd
binary source binary
contents ^source contents
contentsSpecies ^source contentsSpecies
next self hereChar: source next. self sourceTrailNextPut: hereChar. ^hereChar
next: anInteger "Answer the next anInteger elements of the receiver." | newCollection res | newCollection := self contentsSpecies new: anInteger. res := self next: anInteger into: newCollection startingAt: 1. self sourceTrailNextPutAll: res. ^res
next: anInteger into: aSequenceableCollection startingAt: startIndex "Store the next anInteger elements of the receiver into aSequenceableCollection starting at startIndex in aSequenceableCollection. Answer aSequenceableCollection." | index stopIndex | index := startIndex. stopIndex := index + anInteger. [[index < stopIndex and: [self atEnd not ]] whileTrue: [aSequenceableCollection at: index put: source next. index := index + 1]] on: Stream endOfStreamSignal do: [:ex | ex retryUsing: [(Stream incompleteNextCountSignal newExceptionFrom: self) parameter: index - startIndex; raiseRequest]]. ^aSequenceableCollection
nextLine ^self scanUntil: [ self matchCharacterType: CRLFMask ]
nextLineWithoutTerminator " Answer next line. Do not inlude cr. Stream is positioned before terminating cr " ^self scanWhile: [ (self matchCharacterType: CRLFMask) not ].
peek ^source peek
peekFor: anObject "Answer false and do not move the position if self next ~= anObject or if the receiver is at the end. Answer true and increment position if self next = anObject." | nextObject | self atEnd ifTrue: [^false]. nextObject := self next. "peek for matching element" anObject = nextObject ifTrue: [^true]. "gobble it if found" self stepBack. ^false
position ^source position
position: anInt source position: anInt
skip: integer source skip: integer. self sourceTrailSkip: integer.
text ^source text
throughAll: pattern | str | str := source throughAll: pattern. self sourceTrailNextPutAll: str. ^str
upTo: anObject "Answer a subcollection from position to the occurrence (if any, exclusive) of anObject. The stream is left positioned after anObject. If anObject is not found answer everything." | newStream element | newStream := (self contentsSpecies new: 64) writeStream. [self atEnd] whileFalse: [element := self next. element = anObject ifTrue: [^newStream contents]. newStream nextPut: element.]. ^newStream contents
upToAll: pattern | str | str := source upToAll: pattern. self sourceTrailNextPutAll: str. ^str
upToAndSkipThroughAll: pattern | str | str := source upToAndSkipThroughAll: pattern. self sourceTrailNextPutAll: str. ^str
upToEnd | str | str := source upToEnd. self sourceTrailNextPutAll: str. ^str
</methods> <methods> Net.SimpleScanner <category>expression types</category>
classificationMaskFor: charOrNil ^self class classificationMaskFor: charOrNil acceptNonAsciiCharacters: self acceptNonAsciiCharacters
classificationMaskFor: charOrNil acceptNonAsciiCharacters: aBoolean ^self class classificationMaskFor: charOrNil acceptNonAsciiCharacters: aBoolean
matchCharacterType: mask ^self classificationMask anyMask: mask
mustMatch: char ^self mustMatch: char notify: [self expected: (String with: char)]
mustMatch: char notify: message self skipWhiteSpace. (self next == char) ifFalse: [self notify: message]
scanTokenMask: tokenMask "Scan token based on character mask. Answers token's value. Stream is positioned before trhe character that terminated scan" ^self scanWhile: [self matchCharacterType: tokenMask]
scanUntil: aNiladicBlock ^self scanUntil: aNiladicBlock do: [:stream :char | stream nextPut: char]
scanUntil: aNiladicBlock do: actionBlock "Scan token using a block until match is found. At the end of scan the stream is positioned after the matching character. Answers token value" | stream | stream := (String new: 64) writeStream. [self atEnd ifTrue: [self hereChar: nil. ^stream contents]. self step. aNiladicBlock value] whileFalse: [actionBlock value: stream value: hereChar]. ^stream contents
scanWhile: aNiladicBlock "Scan token using a block. At the end of scan the stream is positioned at the first character that does not match. hereChar is nil. Answers token value" | str | str := self scanUntil: [ aNiladicBlock value not ]. hereChar notNil ifTrue: [ self stepBack ]. ^str
scanWhile: aNiladicBlock do: actionBlock "Scan token using a block. At the end of scan the stream is positioned at the first character that does not match. hereChar is nil. Answers token value" | str | str := self scanUntil: [ aNiladicBlock value not ] do: actionBlock. hereChar notNil ifTrue: [ self stepBack ]. ^str
step ^self next.
stepBack self skip: -1.
</methods> <methods> Net.SimpleScanner <category>accessing</category>
acceptNonAsciiCharacters ^acceptNonAsciiCharacters ifNil: [ acceptNonAsciiCharacters := self class acceptNonAsciiCharacters ]
acceptNonAsciiCharacters: aBoolean acceptNonAsciiCharacters := aBoolean
classificationMask ^classificationMask
currentComment ^currentComment
hereChar ^hereChar
hereChar: char hereChar := char. classificationMask := self classificationMaskFor: hereChar
saveComments ^saveComments
saveComments: aValue saveComments := aValue
size ^source size
source ^source
source: aStreamSegment source := aStreamSegment
stream ^source stream
token ^token
tokenType ^tokenType
</methods> <methods> Net.SimpleScanner <category>source trail</category>
sourceTrail | res | sourceTrailStream notNil ifTrue: [res := sourceTrailStream contents]. sourceTrailStream := nil. ^res
sourceTrailNextPut: char (sourceTrailStream notNil and: [char notNil]) ifTrue: [sourceTrailStream nextPut: char]
sourceTrailNextPutAll: string (sourceTrailStream notNil and: [string notNil]) ifTrue: [sourceTrailStream nextPutAll: string]
sourceTrailOff sourceTrailStream := nil
sourceTrailOn sourceTrailStream := (String new: 64) writeStream.
sourceTrailSkip: integer sourceTrailStream notNil ifTrue: [sourceTrailStream skip: integer]
</methods> <methods> Net.SimpleScanner <category>instance creation</category>
asStream ^source
from: start to: end ^self newSize: end - start startingAt: start
newSize: size ^self species on: (self asStream newSize: size )
newSize: sizeNumber startingAt: aNumber ^self species on: (self asStream newSize: sizeNumber startingAt: aNumber)
</methods> <methods> Net.SimpleScanner <category>tokenization</category>
nextToken self subclassResponsibility
nextTokenAsAssociation " Read next token and and answer tokenType->token " self nextToken. ^tokenType->token
scanToken: aNiladicBlock delimitedBy: anArray notify: errorMessageString " Scan next lexical token based on the criteria defined by NiladicBlock. The block is evaluated for every character read from input stream until it yields false. Stream is positioned before character that terminated scan" "Example: self scanToken: [ self scanQuotedChar; matchCharacterType: DomainTextMask ] delimitedBy: '[]' notify: 'Malformed domain text'." | string | self mustMatch: anArray first. string := self scanWhile: aNiladicBlock. self mustMatch: anArray last notify: errorMessageString. ^string
scanTokens: textOrString "Answer with an Array which has been tokenized" ^self on: (ReadStream on: textOrString asString); tokenize.
tokenize | s | s := WriteStream on: (Array new: 16). [self nextToken. tokenType = #doIt] whileFalse: [s nextPut: token]. ^s contents
tokenizeList: aBlock separatedBy: comparisonBlock " list = token *( separator token) " | stream block v | stream := (Array new: 4) writeStream. block := [(v := aBlock value) notNil ifTrue: [stream nextPut: v]]. block value. " Evaluate for the first element " self tokenizeWhile: [comparisonBlock value ] do: block. ^stream contents
tokenizeUntil: aBlock do: actionBlock [self skipWhiteSpace. self position. self nextToken. tokenType == #doIt or: aBlock] whileFalse: [actionBlock value].
tokenizeWhile: aBlock | s | s := WriteStream on: (Array new: 16). self tokenizeWhile: [aBlock value] do: [s nextPut: token]. ^s contents
tokenizeWhile: aBlock do: actionBlock | pos | [self skipWhiteSpace. pos := self position. self nextToken. tokenType ~= #doIt and: aBlock value] whileTrue: [actionBlock value]. self position: pos "Reset position to the beginning of the token that did not match"
</methods> <methods> Net.SimpleScanner <category>error handling</category>
expected: aString "Notify that there is a problem at current token." ^ self notify: ((#expected << #dialogs >> '<1s> expected')expandMacrosWith: aString)
notify: string "Subclasses may wish to override this" self error: string
offEnd: aString "Parser overrides this" ^self notify: aString
</methods> <methods> Net.SimpleScanner <category>initialize-release</category>
initialize saveComments := true. self hereChar: nil
on: inputStream "Bind the input stream" self hereChar: nil. self source: inputStream asStream
on: inputStream from: startPositionNumber to: sizeNumber self on: (StreamSegment on: inputStream asStream offset: startPositionNumber size: sizeNumber)
scan: inputStream "Bind the input stream, fill the character buffers and first token buffer" self on: inputStream. ^self nextToken
</methods> <methods> Net.SimpleScanner <category>sunit test helpers</category>
testScanTokens | s st | s := WriteStream on: (Array new: 16). st := WriteStream on: (Array new: 16). [tokenType = #doIt] whileFalse: [s nextPut: token. st nextPut: tokenType. self nextToken]. ^Array with: s contents with: st contents
testScanTokens: textOrString "Answer with an Array which has been tokenized" self scan: (ReadStream on: textOrString asString). ^self testScanTokens.
</methods> <methods> Net.SimpleScanner <category>positioning</category>
close source close
reset "Set the receiver's position to start position." source reset
</methods> <methods> Net.SimpleScanner <category>multi-character scans</category>
skipWhiteSpace "It is inefficient because intermediate stream is created. Perhaps refactoring scanWhile: can help" self scanWhile: [self matchCharacterType: WhiteSpaceMask]
</methods> <methods> Net.SimpleScanner <category>printing</category>
printToken: assoc on: stream self class printToken: assoc on: stream
printToken: value tokenType: aSymbol on: stream self class printToken: value tokenType: aSymbol on: stream
</methods> <methods> Net.SimpleScanner <category>private</category>
resetToken token := tokenType := nil
</methods> <methods> Net.SimpleScanner <category>testing</category>
isScanner ^true
</methods> <methods> Net.SimpleScanner class <category>instance creation</category>
new ^super new initialize
on: stream ^self new on: stream
on: stream from: startPositionNumber to: sizeNumber ^self new on: stream from: startPositionNumber to: sizeNumber
</methods> <methods> Net.SimpleScanner class <category>class initialization</category>
initClassificationTable classificationTable := WordArray new: 256. self initClassificationTableWith: AlphabeticMask when: [:c | ($a <= c and: [c <= $z]) or: [$A <= c and: [c <= $Z]]]. self initClassificationTableWith: DigitMask when: [:c | c >= $0 and: [c <= $9]]. self initClassificationTableWith: WhiteSpaceMask when: [:c | #(32 "space" 9 "tab") includes: c asInteger]. self initClassificationTableWith: CRLFMask when: [:c | c == Character cr or: [ c == Character lf ] ]. self initClassificationTableWith: EndOfLineMask when: [:c | c == Character cr ].
initClassificationTableWith: mask when: aBlock "Set the mask in all entries of the classificationTable for which aBlock answers true." 0 to: classificationTable size-1 do: [:i | (aBlock value: (Character value: i)) ifTrue: [classificationTable at: i + 1 put: ((classificationTable at: i+1) maskSet: mask)]]
initialize "SimpleScanner initialize" self initializeConstants; initClassificationTable
initializeConstants AlphabeticMask := 1. DigitMask := 2. WhiteSpaceMask := 4. CRLFMask := 8. EndOfLineMask := 16. NilMask := 0. Cr := Character cr. Lf := Character lf. CRLF := Array with: Character cr with: Character lf.
</methods> <methods> Net.SimpleScanner class <category>accessing</category>
acceptNonAsciiCharacters ^acceptNonAsciiCharacters ifNil: [acceptNonAsciiCharacters := self acceptNonAsciiCharactersValue ]
acceptNonAsciiCharacters: aBoolean acceptNonAsciiCharacters := aBoolean
acceptNonAsciiCharactersValue ^false
anyTextMask ^AnyTextMask
classificationMaskFor: charOrNil ^self classificationMaskFor: charOrNil acceptNonAsciiCharacters: self acceptNonAsciiCharacters
classificationMaskFor: charOrNil acceptNonAsciiCharacters: aBoolean | ind | ^charOrNil isNil ifTrue: [NilMask] ifFalse: [ind := charOrNil asInteger + 1. ind > 127 ifTrue: [ ^aBoolean ifTrue: [ AnyTextMask] ifFalse: [ NonASCIICharacter signalWith: charOrNil] ]. self classificationTable at: ind ]
classificationTable ^classificationTable isNil ifTrue: [ superclass classificationTable ] ifFalse: [ classificationTable ]
classificationTable: aValue classificationTable := aValue
cr ^Cr
crlf ^CRLF
lf ^Lf
</methods> <methods> Net.SimpleScanner class <category>printing</category>
defaultTokenType self subclassResponsibility
printToken: assocOrValue on: stream | tokenType token | (assocOrValue isKindOf: Association) ifTrue: [tokenType := assocOrValue key. token := assocOrValue value] ifFalse: [tokenType := self defaultTokenType. token := assocOrValue]. self printToken: token tokenType: tokenType on: stream
printToken: value tokenType: aSymbol on: stream self subclassResponsibility
</methods> <methods> Net.SimpleScanner class <category>character classification</category>
whiteSpace ^String with: Character space with: Character tab
</methods> <methods> Net.INIScanner <category>tokenization</category>
nextNVPair | pos key | self skipComments. pos := self position. key := self nextToken. key notNil ifTrue: [ self skipWhiteSpace. (self peekFor: $= ) ifTrue: [ ^ key -> (self skipWhiteSpace; nextLine) trimBlanks ]. self position: pos. self warnOnSkippedLine ]. ^ nil.
nextSection | key | (key := self nextSectionHeader) notNil ifTrue: [ ^ key -> self scanSectionBody ]. ^ nil.
nextSectionHeader "Section headers must start at the beginning of the line." [self atEnd not and: [self peek ~~ $[]] whileTrue: [ self nextLine ]. self atEnd ifTrue: [ tokenType := #doIt. ^ token := nil ]. token := self scanToken: [ self matchCharacterType: TokenMask ] delimitedBy: '[]' notify: (#errMalformedSectionHeader << #dialogs >> 'Malformed section header'). self nextLine. ^ token.
nextToken ^self nextIniToken
scanSectionBody "Answer a Dictionary containing the section's key/value pairs. Empty value is allowed. No protection against duplicate keys - last entry in stream is installed." | section nv | section := Dictionary new. [self skipComments. self atEnd not and: [self peek ~~ $[]] whileTrue: [ (nv := self nextNVPair) notNil ifTrue: [section add: nv]. self skipComments ]. ^ section.
scanToken " token = 1*<any CHAR except $[, $], $=, SPACE and CTLs>. " token := self scanTokenMask: TokenMask. tokenType := #token. ^token
sectionNamed: aString | name | [ name := self nextSectionHeader. name notNil and: [name asLowercase ~= (aString asLowercase)] ] whileTrue. ^ self scanSectionBody.
skipComments self skipWhiteSpace. [CommentChars includes: self peek] whileTrue: [self nextLine].
tokenizeAsDictionary | ini section | ini := Dictionary new. [ self atEnd ] whileFalse: [ (section := self nextSection) notNil ifTrue: [ ini add: section ] ]. ^ ini.
warnOnSkippedLine ^ScannedLineSkipped signalWith: ((#ScannedLine1sSkipped << #net >> 'Scanned line ''<1s>'' skipped.') expandMacrosWith: self nextLine).
</methods> <methods> Net.INIScanner <category>private</category>
nextIniToken | char | self skipWhiteSpace. char := self peek. char isNil "end of input" ifTrue: [ tokenType := #doIt. ^ token := nil]. token := self scanToken. " Tokens must be arranged in name = value pairs. where value is allowed to be empty. " token isEmpty ifTrue: [ tokenType := #none. ^ token := nil]. ^ token.
</methods> <methods> Net.INIScanner class <category>class initialization</category>
initClassificationTable super initClassificationTable. self initClassificationTableWith: TokenMask when: [:c | c > Character space and: [ ('[]=' includes: c) not ] ]. self initClassificationTableWith: EndOfLineMask when: [:c | c == Character cr or: [ c == Character lf ] ].
initialize "INIScanner initialize" self initializeConstants; initClassificationTable
initializeConstants TokenMask := 16384.
</methods> <methods> Net.NetConnection <category>stream</category>
close self disconnect
commit stream flush.
disconnect stream notNil ifTrue: [ stream close. stream := nil.]
</methods> <methods> Net.NetConnection <category>testing</category>
isConnected ^stream notNil
isSecure ^false
</methods> <methods> Net.NetConnection <category>defaults</category>
defaultEncoding ^self class defaultEncoding
defaultLineEndConvention ^self class defaultLineEndConvention
</methods> <methods> Net.NetConnection <category>accessing</category>
getResponseStream ^stream
stream ^stream
</methods> <methods> Net.NetConnection <category>private</category>
createSocketTimeout: aNumber ^self class defaultSocketAccessor family: (SocketAddress domainCodeFromName: #afInet) type: SocketAccessor sockStream.
socketStreamWithEncoding: aSymbol host: aHost port: aPortNumber timeout: tmNumber | aSocket | aSocket := self createSocketTimeout: tmNumber. [aSocket connectTo: (IPSocketAddress hostName: aHost port: ( aPortNumber ifNil: [self class defaultPortNumber ]) ). ] ifCurtailed: [aSocket close]. ^(aSocket asExternalConnection withEncoding: aSymbol) readAppendStream lineEndConvention: self defaultLineEndConvention.
</methods> <methods> Net.NetConnection <category>initialize-release</category>
openStreamFor: aHost port: aPortNumber timeout: tmNumber stream := self socketStreamWithEncoding: self defaultEncoding host: aHost port: aPortNumber timeout: tmNumber. ^stream
</methods> <methods> Net.NetConnection class <category>default values</category>
defaultEncodingValue ^#ISO8859_1
defaultLineEndConvention ^LineEndCRLF
defaultPortNumber ^self subclassResponsibility
defaultSocketAccessor ^SocketAccessor
</methods> <methods> Net.NetConnection class <category>defaults</category>
defaultEncoding ^encoding ifNil: [ encoding :=self defaultEncodingValue ]
defaultEncoding: aSymbol encoding := aSymbol
</methods> <methods> Net.Settings class <category>accessing settings</category>
anonymousLoginPassword (self registry at: #anonymousLoginPassword ifAbsent: [ nil ]) isNil ifTrue: [(self defaultIdentity notNil and: [self defaultIdentity mailAddress notNil]) ifTrue: [self registry at: #anonymousLoginPassword put: self defaultIdentity mailAddress]]. ^self registry at: #anonymousLoginPassword ifAbsent: [ nil ]
defaultIdentity ^self registry at: #defaultIdentity ifAbsent: [nil ]
defaultIdentity: aNetUser self registry at: #defaultIdentity put: aNetUser. self changed: #changedDefaultIdentity with: aNetUser
defaultIncomingHost ^self registry at: #defaultIncomingServer ifAbsent: [nil ]
defaultIncomingHost: aHostSpec self registry at: #defaultIncomingServer put: aHostSpec. self changed: #changedDefaultIncomingServer with: aHostSpec
defaultOutgoingHost ^self registry at: #defaultOutgoingServer ifAbsent: [ nil ]
defaultOutgoingHost: aHostSpec self registry at: #defaultOutgoingServer put: aHostSpec. self changed: #changedDefaultOutgoingServer with: aHostSpec
ftpAnonymousLoginPassword ^self anonymousLoginPassword
ftpAnonymousLoginPassword: aString self registry at: #anonymousLoginPassword put: aString. self changed: #chagedAnonymousLoginPassword with: aString
ftpAnonymousUser ^NetUser new fullName: 'anonymous'; username: 'anonymous'; password: self anonymousLoginPassword; yourself.
ftpPassiveMode ^self registry at: #ftpPassiveMode ifAbsentPut: [ self ftpPassiveModeDefault ]
ftpPassiveMode: aBoolean self registry at: #ftpPassiveMode put: aBoolean. self changed: #changedFtpPassiveMode with: aBoolean
ftpPassiveModeDefault ^false
httpDomain ^self registry at: #httpDomain ifAbsent: [self httpDomainDefaultValue]
httpDomain: aString ^self registry at: #httpDomain put: aString
httpDomainDefaultValue ^CEnvironment getenv: 'USERDOMAIN'
httpKeepAlive ^self registry at: #httpKeepAlive ifAbsentPut: [self httpKeepAliveDefault ]
httpKeepAlive: aBoolean self registry at: #httpKeepAlive put: aBoolean. self changed: #changedHttpKeepAlive with: aBoolean.
httpKeepAliveDefault ^true
httpProxyExceptions ^self registry at: #httpProxyExceptions ifAbsentPut: [OrderedCollection new ]
httpProxyExceptions: aList ^self registry at: #httpProxyExceptions put: aList
httpProxyHost ^self registry at: #httpProxyHost ifAbsent: [ nil ]
httpProxyHost: aHostSpec self registry at: #httpProxyHost put: aHostSpec. self addIdentity: self httpProxyHost netUser. self changed: #changedHttpProxyHost with: aHostSpec. httpProxyHostAspect := self registry at: #httpProxyHost.
httpProxyHostAspect ^httpProxyHostAspect isNil ifTrue: [httpProxyHostAspect := self httpProxyHost isNil ifTrue: [String new] ifFalse: [ self httpProxyHost]] ifFalse: [httpProxyHostAspect]
httpProxyUser ^self httpProxyHost notNil ifTrue: [ self httpProxyHost netUser] ifFalse: [ nil ]
httpRedirectRequest ^self registry at: #httpRedirectRequest ifAbsent: [ self httpRedirectRequestDefault ]
httpRedirectRequest: aBoolean self registry at: #httpRedirectRequest put: aBoolean. self changed: #changedHttpRedirectRequest with: aBoolean
httpRedirectRequestDefault ^true
httpsAutoload ^self registry at: #httpsAutoload ifAbsentPut: [ true ]
httpsAutoload: aBoolean self registry at: #httpsAutoload put: aBoolean. self changed: #changedHttpsAutoload with: aBoolean
httpSetContentLength ^self registry at: #httpSetContentLength ifAbsentPut: [ true ]
httpSetContentLength: aBoolean self registry at: #httpSetContentLength put: aBoolean. self changed: #changedHttpSetContentLength with: aBoolean.
httpUseProxy ^self registry at: #httpUseProxy ifAbsentPut: [self httpUseProxyDefault ]
httpUseProxy: aBoolean self registry at: #httpUseProxy put: aBoolean. self changed: #changedHttpUseProxy with: aBoolean.
httpUseProxyDefault ^false
httpUser ^self registry at: #httpUser ifAbsent: [nil ]
httpUser: aNetUser self registry at: #httpUser put: aNetUser. aNetUser notNil ifTrue: [ self addIdentity: aNetUser]. self changed: #changedHttpUser with: aNetUser.
identities ^self registry at: #identities ifAbsentPut: [OrderedCollection new ]
mailServers ^self registry at: #mailServers ifAbsentPut: [OrderedCollection new ]
setDefaultMailHost: aHostSpec ( self isIncomingTypeHost: aHostSpec) ifTrue: [ self defaultIncomingHost: aHostSpec]. (self isOutgoingTypeHost: aHostSpec) ifTrue: [ self defaultOutgoingHost: aHostSpec]. (self detectMailHost: aHostSpec) == nil ifTrue: [ self mailServers add: aHostSpec ]
</methods> <methods> Net.Settings class <category>removing</category>
removeDefaultIdentity self registry removeKey: #defaultIdentity ifAbsent: [ nil ]. self changed: #removedDefaultIdentity.
removeDefaultIncomingHost self registry removeKey: #defaultIncomingServer ifAbsent: [ nil ]. self changed: #removedDefaultIncomingServer.
removeDefaultOutgoingHost self registry removeKey: #defaultOutgoingServer ifAbsent: [ nil ]. self changed: #removedDefaultOutgoingServer.
removeIdentity: aNetUser | user | (user := self detectIdentity: aNetUser) notNil ifTrue: [ self identities remove: user]. self mailServers do: [ :ea | (user := ea netUser) notNil ifTrue: [ user fullName = aNetUser fullName ifTrue: [ea netUser: nil ]]]. self httpProxyHost notNil ifTrue: [(user := self httpProxyHost netUser) notNil ifTrue: [ user fullName = aNetUser fullName ifTrue: [ self httpProxyHost netUser: nil ]]]. self httpUser notNil ifTrue: [ self httpUser fullName = aNetUser fullName ifTrue: [ self httpUser: nil ]]. self changed: #removedIdentity with: aNetUser.
removeMailHost: aHostSpec | host | (host := self detectMailHost: aHostSpec) notNil ifTrue: [ self mailServers remove: host. self changed: #removedMailServer with: aHostSpec. ( self isDefaultIncomingHost: aHostSpec) ifTrue: [ self removeDefaultIncomingHost]. ( self isDefaultOutgoingHost: aHostSpec) ifTrue: [ self removeDefaultOutgoingHost]]
resetIdentities self removeDefaultIdentity. ^self registry at: #identities put: OrderedCollection new
resetServers self removeDefaultIncomingHost. self removeDefaultOutgoingHost. ^self registry at: #mailServers put: OrderedCollection new
</methods> <methods> Net.Settings class <category>detecting</category>
detectIdentity: aNetUser ^self identities detect: [ :each | each fullName = aNetUser fullName] ifNone: [ nil ]
detectIdentityByName: aName ^self identities detect: [ :each | each fullName = aName] ifNone: [ nil ]
detectMailClientFor: aHostSpec aHostSpec type isNil ifTrue: [^nil]. ^self supportedMailClients detect: [ :ea | ea serverType asSymbol = aHostSpec type asSymbol ] ifNone: [nil].
detectMailHost: aHostSpec ^self mailServers detect: [ :each | each name = aHostSpec name] ifNone: [ nil ]
detectMailHostByName: aString ^self mailServers detect: [ :each | each name = aString ] ifNone: [ nil ]
</methods> <methods> Net.Settings class <category>class initialization</category>
initialize "Settings initialize" self initializeRegistry.
initializeRegistry Registry isNil ifTrue: [ self resetRegistry ].
registry ^Registry
resetRegistry " self resetRegistry " Registry := Dictionary new.
</methods> <methods> Net.Settings class <category>adding</category>
addIdentity: aNetUser | user | aNetUser isNil ifTrue: [^nil]. (user := self detectIdentity: aNetUser) notNil ifTrue: [ user updateBy: aNetUser. self changed: #updatedIdentity with: aNetUser] ifFalse: [ self identities add: aNetUser. self changed: #addedIdentity with: aNetUser]
updateMailHost: aHostSpec | host | (host := self detectMailHost: aHostSpec) notNil ifTrue: [ host updateBy: aHostSpec. self changed: #updatedMailHost with: host] ifFalse: [ self mailServers add: aHostSpec. self changed: #addedMailHost with: aHostSpec]
</methods> <methods> Net.Settings class <category>mail server types</category>
serverTypeDescriptionFor: aHostSpec | cl | cl := self supportedMailClients detect: [ :ea | ea serverType asSymbol = aHostSpec type asSymbol ] ifNone: [nil]. ^cl notNil ifTrue: [ cl description ] ifFalse: [String new].
supportedMailClients " mail server type and server description" | col | col := OrderedCollection new. NetClient mailRegistry values do: [ :ea | col add: ((LiteralBindingReference pathString: 'Net.',ea ) value)]. ^col
</methods> <methods> Net.Settings class <category>testing</category>
hasIdentityReference: aNetUser | usr | self mailServers detect: [ :ea | (usr := ea netUser) notNil ifTrue: [ (usr fullName = aNetUser fullName) ifTrue: [ ^true]]. false] ifNone: [nil]. self httpProxyHost notNil ifTrue: [(usr := self httpProxyHost netUser) notNil ifTrue: [ (usr fullName = aNetUser fullName) ifTrue: [^true]]]. (usr := self httpUser) notNil ifTrue: [ (usr fullName = aNetUser fullName) ifTrue: [^true]]. ^false
isDefaultIdentity: aNetUser | usr | ^(usr := self registry at: #defaultIdentity ifAbsent: [ nil ]) notNil ifTrue: [ usr fullName = aNetUser fullName] ifFalse: [ false ]
isDefaultIncomingHost: aHostSpec | srv | ^(srv := self registry at: #defaultIncomingServer ifAbsent: [ nil ]) notNil ifTrue: [ srv name = aHostSpec name] ifFalse: [ false ]
isDefaultMailHost: aHostSpec | srv | (self isMailHost: aHostSpec) ifFalse: [^false]. srv := (( self isIncomingTypeHost: aHostSpec) ifTrue: [ self registry at: #defaultIncomingServer ifAbsent: [ nil ]] ifFalse: [self registry at: #defaultOutgoingServer ifAbsent: [ nil ]]). ^srv notNil ifTrue: [ srv name = aHostSpec name] ifFalse: [ true ]
isDefaultOutgoingHost: aHostSpec | srv | ^(srv := self registry at: #defaultOutgoingServer ifAbsent: [ nil ]) notNil ifTrue: [ srv name = aHostSpec name] ifFalse: [ false ]
isIncomingTypeHost: aHostSpec | cl | ^(cl := self detectMailClientFor: aHostSpec) notNil ifTrue: [ cl isIncomingMailClient ] ifFalse: [false]
isMailHost: aHostSpec ^(self detectMailClientFor: aHostSpec) notNil
isOutgoingTypeHost: aHostSpec | cl | ^(cl := self detectMailClientFor: aHostSpec) notNil ifTrue: [ cl isOutgoingMailClient ] ifFalse: [false]
</methods> <methods> Tools.MailIncrementNotification <category>accessing</category>
endingCount: aNumber endingCount := aNumber
ticks "Answer the number of ticks were signalled." ^parameter == nil ifTrue: [ 1 ] ifFalse: [ parameter ]
</methods> <methods> Tools.MailIncrementNotification class <category>signalling</category>
signalWith: aParameter endingCount: endingCount "Raise an an exception with parameter set to aParameter." ^self new searchFrom: thisContext sender; originator: thisContext sender homeReceiver; parameter: aParameter; endingCount: endingCount; raiseSignal.
</methods> <methods> Net.NetProtocolInterpreter <category>connection management</category>
connectToHost: aHostName port: aNumber timeout: tmNumber ^self connection openStreamFor: aHostName port: aNumber timeout: tmNumber
disconnect self connection disconnect.
</methods> <methods> Net.NetProtocolInterpreter <category>testing</category>
isConnected ^self connection isConnected
</methods> <methods> Net.NetProtocolInterpreter <category>debugging</category>
log: aString level: aLevel self class log: aString level: aLevel
</methods> <methods> Net.NetProtocolInterpreter <category>public</category>
executeCommand: aString
</methods> <methods> Net.NetProtocolInterpreter <category>accessing</category>
connection connection ifNil: [self useDefaultConnection]. ^connection
netConnectionClass ^self class defaultNetConnection
responseStream ^self connection getResponseStream
stream ^self connection stream
</methods> <methods> Net.NetProtocolInterpreter <category>initialize-release</category>
connection: aNetConnection connection := aNetConnection
initialize
useDefaultConnection connection := self netConnectionClass new
</methods> <methods> Net.NetProtocolInterpreter <category>secure connection</category>
loadSecureConnection #{Net.SSLConnection} valueOrDo: [URI tryToLoad: 'NetSecureConnection']
sslConnectionClass ^#{Net.SSLConnection} value
sslContext ^(connection notNil and: [ connection isSecure ]) ifTrue: [connection sslContext ] ifFalse: [ nil ]
sslContext: anSSLContext (connection notNil and: [ connection isSecure not]) ifTrue: [ ^NetClientError raiseSignal: (#CanNotSSLContext << #net >> 'Can not set SSLContext to connection') ]. connection ifNil: [ connection := self sslConnectionClass new ]. connection sslContext: anSSLContext
useSecureConnection self loadSecureConnection. connection := self sslConnectionClass new.
validationBlock ^(connection notNil and: [ connection isSecure ]) ifTrue: [connection validationBlock ] ifFalse: [ nil ]
validationBlock: aBlock (connection notNil and: [ connection isSecure not]) ifTrue: [ ^NetClientError raiseSignal: (#CanNotValidationBlock << #net >> 'Can not set validationBlock to the connection') ]. connection isNil ifTrue: [ connection := self sslConnectionClass new ]. connection validationBlock: aBlock
</methods> <methods> Net.NetProtocolInterpreter class <category>debugging</category>
debugLabelsAndValues ^OrderedCollection new add: ((#NetClientMessages << #net >> 'Net Client Messages')->#NetClient); yourself
log: aString level: aLevel #{Tools.LogEnvironment} ifDefinedDo: [ :le | le default log: aString level: aLevel ]
menuItemName ^(#NetClientMessages << #net >> 'Net Client Messages')
registerToDebug #{Tools.LogEnvironment} ifDefinedDo: [ :le | le default addToDebug: self ]
</methods> <methods> Net.NetProtocolInterpreter class <category>instance creation</category>
new ^super new initialize
onNetConnection: aNetConnection ^self new connection: aNetConnection; yourself
</methods> <methods> Net.NetProtocolInterpreter class <category>defaults</category>
defaultNetConnection ^defaultNetConnection ifNil: [defaultNetConnection := self defaultNetConnectionValue]
defaultNetConnection: aNetConnection defaultNetConnection := aNetConnection
</methods> <methods> Net.NetProtocolInterpreter class <category>default values</category>
defaultNetConnectionValue ^self subclassResponsibility
</methods> <methods> Net.NonASCIICharacter class <category>testing</category>
mayResume ^true
</methods> <methods> Net.StreamSegment <category>initialization</category>
initialize position := size := 0
offset: integerPos size: integerSize offset := integerPos. size := integerSize.
stream: aStream source := aStream. size = 0 ifTrue: [ size := aStream size ]. offset isNil ifTrue: [ offset := aStream position ] ifFalse: [ aStream position: offset ]
</methods> <methods> Net.StreamSegment <category>positioning</category>
atEnd ^self evaluateWithProperPositioning: [self privateAtEnd]
close source close
position ^position
position: aNumber position := aNumber
reset "Set the receiver's position to start position." position := 0.
</methods> <methods> Net.StreamSegment <category>instance creation</category>
asStream ^self
from: start to: end ^source from: start + offset to: end + offset
newSize: anInteger ^self newSize: anInteger startingAt: self position
newSize: anInteger startingAt: localOffset ^source newSize: anInteger startingAt: localOffset + offset
</methods> <methods> Net.StreamSegment <category>accessing</category>
asEncodedStreamWithEncoding: aSymbol lineEndConvention: aNumber ^(source asEncodedStreamWithEncoding: aSymbol lineEndConvention: aNumber ) newSize: size startingAt: offset
binary source binary
contents | savePos | savePos := self position. ^[self reset; privateContents] ensure: [self position: savePos]
finish
flush source flush
lineEndConvention ^source lineEndConvention
lineEndConvention: convention convention = LineEndAuto ifTrue: [ self setLineEndConventionFromContents ] ifFalse: [ source lineEndConvention: convention ].
lineEndCRLF source lineEndCRLF
lineEndTransparent ^source lineEndTransparent
needsFileLineEndConversion ^source needsFileLineEndConversion
next ^self evaluateWithProperPositioning: [self privateAtEnd ifTrue: [self pastEnd] ifFalse: [source next]]
next: anInteger ^self evaluateWithProperPositioning: [(source atEnd or: [position + anInteger > self size]) ifTrue: [self pastEnd] ifFalse: [source next: anInteger]]
next: anInteger into: aSequenceableCollection startingAt: startIndex "Store the next anInteger elements of the receiver into aSequenceableCollection starting at startIndex in aSequenceableCollection. Answer aSequenceableCollection." | index stopIndex | ^self evaluateWithProperPositioning: [ index := startIndex. stopIndex := index + anInteger. [[index < stopIndex and: [self privateAtEnd not ]] whileTrue: [aSequenceableCollection at: index put: source next. index := index + 1]] on: Stream endOfStreamSignal do: [:ex | ex retryUsing: [(Stream incompleteNextCountSignal newExceptionFrom: self) parameter: index - startIndex; raiseRequest]]. aSequenceableCollection]
nextAvailable: anInteger "Answer the next anInteger elements of the receiver. If there are not enough elements available, answer a collection of as many as are available." ^self evaluateWithProperPositioning: [ | newCollection count | newCollection := self contentsSpecies withSize: anInteger. count := self nextAvailable: anInteger into: newCollection startingAt: 1. count = anInteger ifTrue: [newCollection] ifFalse: [newCollection copyFrom: 1 to: count]]
nextPut: aByte ^self evaluateWithProperPositioning: [source atEnd ifTrue: [self pastEnd] ifFalse: [source nextPut: aByte]]
offset ^offset
peek "Answer what would be returned with a self next, without changing position. If the receiver is at the end, answer nil." | nextObject | ^self evaluateWithProperPositioning: [self privateAtEnd ifTrue: [^nil]. nextObject := source next. source skip: -1. nextObject]
peekFor: anObject "Answer false and do not move the position if self next ~= anObject or if the receiver is at the end. Answer true and increment position if self next = anObject." | nextObject | self evaluateWithProperPositioning: [self privateAtEnd ifTrue: [^false]. nextObject := source next. "peek for matching element" anObject = nextObject ifTrue: [^true]. "gobble it if found" source skip: -1]. ^false
size ^size
skip: integer self evaluateWithProperPositioning: [source skip: integer]
skipSeparators "Move the receiver's position past any separators." [[self next isSeparator] whileTrue. "We will not reach here if the end-of-stream is encountered" self skip: -1] on: EndOfStreamNotification do: [:ex | ex return]
skipThroughAll: pattern "Skip forward to the next occurrence (if any) of aCollection. If found, leave the stream positioned after the occurrence, and answer the receiver; if not found, answer nil, and leave the stream positioned at the end." ^self upToAll: pattern returnMatch: false includePattern: false.
skipToAll: anObject ^self evaluateWithProperPositioning: [source skipToAll: anObject]
text source text
throughAll: aCollection " Answer a subcollection from the current position through the occurrence (if any, inclusive) of aCollection, and leave the stream positioned after the occurrence. If no occurrence is found, answer the entire remaining stream contents, and leave the stream positioned at the end. " | first length newStream | self evaluateWithProperPositioning: [ newStream := (self contentsSpecies new: 64) writeStream. (length := aCollection size) = 0 ifTrue: [^newStream contents]. first := aCollection at: 1. [self privateAtEnd] whileFalse: [| element | element := source next. newStream nextPut: element. element = first ifTrue: [| nonMatch nextPos | nonMatch := 2. nextPos := source position. [nonMatch > length ifTrue: [" Success. " newStream skip: -1. "Since the first element has been put in" newStream nextPutAll: aCollection. ^newStream contents]. self privateAtEnd ifTrue: " Not found. " [" Copy the partial match. " source position: nextPos. [self privateAtEnd] whileFalse: [newStream nextPut: source next]. ^newStream contents]. source next = (aCollection at: nonMatch)] whileTrue: [nonMatch := nonMatch + 1]. " Didn't match, back up. " source position: nextPos]]]. " Not found. " ^newStream contents
upTo: anObject "Answer a subcollection from position to the occurrence (if any, exclusive) of anObject. The stream is left positioned after anObject. If anObject is not found answer everything." | newStream element | ^self evaluateWithProperPositioning: [newStream := (source contentsSpecies new: 64) writeStream. [self privateAtEnd] whileFalse: [element := source next. element = anObject ifTrue: [^newStream contents]. newStream nextPut: element.]. newStream contents]
upToAll: aCollection " Answer a subcollection from the current position up to the occurrence (if any, not inclusive) of aCollection, and leave the stream positioned before the occurrence. If no occurrence is found, answer the entire remaining stream contents, and leave the stream positioned at the end. " | first length newStream| self evaluateWithProperPositioning: [ (length := aCollection size) = 0 ifTrue: [^self]. first := aCollection at: 1. newStream := (source contentsSpecies new: 64) writeStream. [self privateAtEnd] whileFalse: [| element | element := source next. newStream nextPut: element. element = first ifTrue: [| nonMatch | nonMatch := 2. [nonMatch > length ifTrue: [" Success. Back up over the occurrence. " source skip: length negated. newStream skip: -1. "Since the first element has been put in" ^newStream contents]. self privateAtEnd ifTrue: " Not found. " [source skip: 2 - nonMatch. " Copy the partial match. " [self privateAtEnd] whileFalse: [newStream nextPut: source next]. ^newStream contents]. source next = (aCollection at: nonMatch)] whileTrue: [nonMatch := nonMatch + 1]. " Didn't match, back up. " source skip: 1 - nonMatch]]]. " Not found. " ^newStream contents
upToAll: pattern returnMatch: returnMatch includePattern: includePattern " ^ <Integer> This matches pattern in the stream, starting from the current position. It has a fairly complex API, so you might want to use one of the simpler senders, upToAll:, upToAndSkipThroughAll:, or throughAll: It uses the Knuth-Morris-Pratt algorithm, from Cormen et al.'s Algorithms, page 871. See also Gusfield's Alorithms on Strings, Trees and Sequences, page 23. This algorithm has the advantage in stream matching that it reads every character in the the text to be matched against exactly once, and never backtracks." | current backupArray resultStream numberMatched | (pattern isEmpty or: [ self atEnd ]) ifTrue: [ ^returnMatch ifTrue: [self contentsSpecies new] ifFalse: [self]]. "Empty counts as found" resultStream := ReadWriteStream on: (self contentsSpecies new: 100). backupArray := source computePrefixFunctionFor: pattern. numberMatched := 0. [self privateAtEnd] whileFalse: [ current := self next. returnMatch ifTrue: [resultStream nextPut: current]. "Mismatch, back up the previous partial match position, as precalculated" [numberMatched > 0 and: [ (pattern at: numberMatched + 1) ~= current]] whileTrue: [numberMatched := backupArray at: numberMatched]. (pattern at: numberMatched + 1) = current ifTrue: [numberMatched := numberMatched + 1]. "We reached the end of the pattern, return the result, omitting the pattern itself" numberMatched = pattern size ifTrue: [ returnMatch ifFalse: [^self]. ^includePattern ifTrue: [resultStream contents] ifFalse: [ resultStream reset. resultStream next: resultStream size - pattern size]]]. "We reached the end of the stream without finding a match. Return everything" ^returnMatch ifTrue: [resultStream contents] ifFalse: [nil].
upToAndSkipThroughAll: pattern " Answer a subcollection from the current position up to the occurrence (if any, not inclusive) of aCollection, and leave the stream positioned after the occurrence. If no occurrence is found, answer the entire remaining stream contents, and leave the stream positioned at the end. " ^self upToAll: pattern returnMatch: true includePattern: false.
upToEnd "Answer a collection consisting of all the elements from the current position to the end of stream." | newStream | ^self evaluateWithProperPositioning: [newStream := (source contentsSpecies new: 64) writeStream. [self privateAtEnd] whileFalse: [newStream nextPut: source next]. newStream contents]
</methods> <methods> Net.StreamSegment <category>private</category>
contentsSpecies ^source contentsSpecies
evaluateWithProperPositioning: aBlock ^[source position: position + offset. aBlock value] ensure: [ position := source position - offset ]
nextAvailable: anInteger into: aSequenceableCollection startingAt: startIndex | currentInd endIndex | self evaluateWithProperPositioning: [ currentInd := startIndex. endIndex := currentInd + anInteger - 1. [ self privateAtEnd or: [ currentInd > endIndex ] ] whileFalse: [ aSequenceableCollection at: currentInd put: source next. currentInd := currentInd + 1 ] ]. ^currentInd - startIndex
pastEnd "The receiver has attempted to read past the end, answer nil." ^Stream endOfStreamSignal raiseRequestFrom: self
privateAtEnd ^source position - offset >= size or: [source atEnd]
privateContents "We need this method because #next: for CRLF line end convention returns more than we need" | collection | ^self evaluateWithProperPositioning: [collection := (source contentsSpecies new: self size) writeStream. [self privateAtEnd ] whileFalse: [ collection nextPut: source next]. collection contents]
setLineEndConventionFromContents | convention | self lineEndTransparent. convention := self withPosition: 0 do: [ :ignoredSavedPosition || wasBinary c | (wasBinary := self isBinary) ifTrue: [ self text ]. [ [ c := self next. c == LF or: [ c == CR or: [ c == nil ] ] ] whileFalse. c == CR ifTrue: [ self next == LF ifTrue: [LineEndCRLF] ifFalse: [LineEndCR]] ifFalse: [ c == LF ifTrue: [LineEndLF] ifFalse: [LineEndTransparent] ] ] ensure: [ wasBinary ifTrue: [ self binary ] ]]. self lineEndConvention: convention.
withPosition: aPosition do: aBlock "Save the current positon of the stream, position the stream to aPosition and then evaluate aBlock with the current position of the stream as an argument. Then reset the position to the original position. Answer the value returned by aBlock." | savedPosition | savedPosition := self position. self position: aPosition. ^[aBlock value: savedPosition] ensure: [self position: savedPosition]
</methods> <methods> Net.StreamSegment <category>testing</category>
isBinary ^source isBinary
isInternal ^source isInternal
isSegmented ^true
</methods> <methods> Net.StreamSegment class <category>instance creation</category>
new ^super new initialize
on: aStream ^(self new) stream: aStream; yourself
on: aStream offset: offsetNumber size: sizeNumber ^(self new) stream: aStream; offset: offsetNumber size: sizeNumber; yourself
</methods> <methods> Net.ScannedLineSkipped <category>private</category>
defaultResumeValue ^self parameter asString
</methods> <methods> Net.ReplaceUnsupportedCharacters <category>errors</category>
noEncodingFor: aCharacter in: aStream | ch | ch := UnsupportedCharacterReplacement newException parameter: aCharacter; raiseRequest. aStream nextPut: ch asInteger. ^ch
</methods> <methods> Net.HostSpec <category>accessing</category>
name ^name
name: aString name := aString
netUser ^netUser
netUser: aNetUser netUser := aNetUser
port ^port
port: aNumber port := aNumber
registry ^Settings
type ^type
type: aString type := aString
</methods> <methods> Net.HostSpec <category>testing</category>
isDefaultMailHost ^self registry isDefaultMailHost: self
isIncomingTypeMail ^self registry isIncomingTypeHost: self
isMailHost ^self registry isMailHost: self
isOutgoingTypeMail ^self registry isOutgoingTypeHost: self
</methods> <methods> Net.HostSpec <category>update</category>
updateBy: aHostSpec self name: aHostSpec name; type: aHostSpec type; netUser: aHostSpec netUser; port: aHostSpec port.
</methods> <methods> Net.HostSpec <category>printing</category>
printDefaultDescriptionOn: aStream aStream nextPutAll: ' ( Default ', (self registry serverTypeDescriptionFor: self) asString, ')'
printDescriptionOn: aStream aStream nextPutAll: ' (', (self registry serverTypeDescriptionFor: self) asString, ')'
printOn: aStream aStream nextPutAll: self name. self isMailHost ifTrue: [self isDefaultMailHost ifTrue: [ self printDefaultDescriptionOn: aStream] ifFalse: [ self printDescriptionOn: aStream]]
specString | stream value | stream := (String new: 32) writeStream. self class instVarNames do: [ :ins | value := self instVarAt: ( self class instVarIndexFor: ins). ins = 'netUser' ifTrue: [ stream nextPutAll: ins, ' = ', value name; cr] ifFalse: [value notNil ifTrue: [stream nextPutAll: ins, ' = ', value printString; cr]]]. ^stream contents.
</methods> <methods> Net.UTF7StreamEncoder <category>testing</category>
isASCII: code ^(self isNotASCII: code) not
isNotASCII: code ^(code < 31 or: [ code > 127 and: [ code <255]])
</methods> <methods> Net.UTF7StreamEncoder <category>accessing</category>
nextFrom: aStream "Decode the next byte(s) in the stream and answer the code." | code c1 | aStream peek isNil ifTrue: [ ^nil]. code := aStream peek. (code = self shiftInCode) ifTrue: [ code := aStream next. ((code = self shiftInCode) and: [ aStream peek = self shiftOutCode]) ifTrue: [ aStream next. ^code]. self shifting: true]. ((code = self shiftOutCode) and: [ self shifting]) ifTrue: [ (c1 := self shiftInNextFrom: aStream) notNil ifTrue: [ ^c1]. self shifting: false. aStream next. aStream peek isNil ifTrue: [ ^nil]]. ^self shifting ifTrue: [ self shiftInNextFrom: aStream] ifFalse: [aStream next ]
nextPut: aCharacter on: aStream "Encode aCharacter and write it to encoded stream." | col c | c := self encoder encode: aCharacter. col := OrderedCollection with: c. c = self shiftInCode ifTrue: [ col add: self shiftOutCode]. col do: [ :code | ( (self isNotASCII: code) and: [ self shifting not ]) ifTrue: [ self shiftIn: aStream. self shifting: true]. ( (self isASCII: code) and: [ self shifting ]) ifTrue: [ self prepareToClose: aStream. self shifting: false ]. self shifting ifTrue: [ self shiftInNextPut: code on: aStream] ifFalse: [ aStream nextPut: code] ]
prepareToClose: aStream self shifting ifTrue: [super prepareToClose: aStream. self shiftOut: aStream]
</methods> <methods> Net.UTF7StreamEncoder <category>private</category>
charsToPad ^0
shiftIn: aStream aStream nextPut: self shiftInCode
shiftInCode ^$+ asInteger
shifting ^shifting isNil ifTrue: [ shifting := false ] ifFalse: [ shifting ]
shifting: aBoolean shifting := aBoolean
shiftInNextFrom: aStream | c1 c2 | c1 := super nextFrom: aStream. c1 == nil ifTrue: [^nil]. c2 := super nextFrom: aStream. c2 == nil ifTrue: [^nil]. ^(c1 bitShift: 8) + c2.
shiftInNextPut: code on: aStream | c1 c2 | c1 := code bitShift: -8. c2 := code bitAnd: 16rFF. self privateNextPut: c1 on: aStream. self privateNextPut: c2 on: aStream.
shiftOut: aStream aStream nextPut: self shiftOutCode
shiftOutCode ^$- asInteger
</methods> <methods> Net.UTF7StreamEncoder <category>manipulating sextets</category>
fillNibbleFrom: aStream | nSextets code enc | enc := self class octetMap. nibble := 0. nSextets := 0. 1 to: 4 do: [ :idx | (aStream atEnd or: [aStream peek == self shiftOutCode]) ifTrue: [ ^nSextets ]. (code := aStream next) isNil ifTrue: [ ^nSextets ]. nibble := nibble bitOr: ((enc at: code ) bitShift: (self shiftValueAt: idx)). nSextets := nSextets + 1. ]. ^nSextets
</methods> <methods> Net.UTF7StreamEncoder class <category>private</category>
defaultCharacterEncoder ^UnicodeCharacterEncoder new
</methods> <methods> Net.UTF7StreamEncoder class <category>accessing</category>
streamEncodingType ^#UTF_7
</methods> <methods> Net.UTF7StreamEncoder class <category>class initialization</category>
initialize "Initialize class variables" super initialize
</methods> <methods> Net.NetClientState <category>accessing</category>
client ^client
client: aMailClient client := aMailClient
stateErrorClass ^self subclassResponsibility
</methods> <methods> Net.NetClientState <category>errors</category>
signalError ^self stateErrorClass raiseSignal
</methods> <methods> Net.MessageElement <category>accessing</category>
parent ^parent
parent: anObject parent := anObject
source ^source
source: anObject source := anObject
sourceContents ^self source contents
sourceSize ^self source size
value ^self getValue
value: anObject value := anObject
</methods> <methods> Net.MessageElement <category>initialization</category>
initialize
</methods> <methods> Net.MessageElement <category>parsing</category>
parse ^self parse: (self scannerOn: self source)
parse: scanner " Each message element has responsibility to parse itself. The argument is an appropriate scanner. Scanners for RFC822, Mime and HTTP messages are stream wrappers, so they can be used to read and tokenize input stream " ^self subclassResponsibility
readFrom: aStream " Each message element has responsibility to read itself from input stream. Reading usually involves parsing, so implementations of this method typically create an instance of lexical scanner and invoke a parser (see explanation for parse: method) " self source: aStream. ^self parse: (self scannerOn: aStream)
scannerOn: aStream " Each element should know what the underlying syntax is. For example, structured fields would mostly use MIME syntax and tokenize input streams into MIME 'tokens' while <address-spec> which is part of many standards, has to be tokenized using RFC822 syntax (using RFC822 'atoms') " ^self class scannerOn: aStream
valueFrom: aString " Swazoo compatibility" ^self readFrom: aString readStream
</methods> <methods> Net.MessageElement <category>visiting</category>
acceptVisit: aVisitor with: argument " Override by invoking appropriate message on the visitor "
</methods> <methods> Net.MessageElement <category>printing</category>
printOn: aStream self printOn: aStream indent: 0
printOn: aStream indent: level ^self subclassResponsibility
storeOn: aStream self printOn: aStream
</methods> <methods> Net.MessageElement <category>copying</category>
postCopy super postCopy. parent := nil.
</methods> <methods> Net.MessageElement <category>composing</category>
writeOn: aStream " Writing can be different from printing. Printing may be indented, abbreviated and otherwise formatted for readability. Writing is used to actually send message. Default implementation is the same " self printOn: aStream
</methods> <methods> Net.MessageElement <category>private</category>
getValue ^value
</methods> <methods> Net.MessageElement class <category>instance creation</category>
new ^super new initialize
</methods> <methods> Net.MessageElement class <category>parsing</category>
readFrom: aStream " Each message element has responsibility to read itself from input stream. Reading usually involves parsing, so implementations of this method create an instance of lexical scanner and invoke a parser (see explanation for parse: method) " ^self new readFrom: aStream
scannerOn: aStream ^(aStream isKindOf: self scannerType) ifTrue: [aStream] ifFalse: [self scannerType on: aStream asStream]
scannerType self subclassResponsibility
</methods> <methods> Net.NetClientError class <category>signalling</category>
signalWith: aParameter message: aString "Raise an an exception with parameter set to aParameter and message set to aString." ^self new searchFrom: thisContext sender; originator: thisContext sender homeReceiver; parameter: aParameter; messageText: aString; raiseSignal.
</methods> <methods> Net.NetworkResponse <category>printing</category>
printOn: aStream | textStream | code isNil ifTrue: [ ^super printOn: aStream ]. aStream nextPutAll: code; space. messageStream notNil ifTrue: [textStream := messageStream contents readStream. aStream nextPutAll: (textStream nextAvailable: 64). textStream atEnd ifTrue: [aStream nextPutAll: '...']].
</methods> <methods> Net.NetworkResponse <category>private</category>
getLine "Return one line from the server, stripping CR/LF." | line | ^((line := self stream nextLine) isNil or: [ line size < 3]) ifTrue: [ nil ] ifFalse: [ #{Tools.LogEnvironment} ifDefinedDo: [ :le | le default log: [((#get1s << #net >> '*get* %<<1s>%>') expandMacrosWith: line)] level: #FTPResponse.]. line ]
hasContinuation: tokens " Answer true if this reply has continuation line(s) " ^(tokens at: 2) == self class continuationToken.
isContinuationLine: line " Answer true if this is a reply continuation line " ^(self isLastLine: line) not
isLastLine: tokens "Answer true if this is a last line of the response, that is, it has space in the fourth position and reply number in positions 1-3 is the same as the current reply number" ^(tokens at: 2) == self class terminationToken and: [tokens first = code]
readResponse "Read first line of the response. Decode response code" "and answer the line" | tokens line | tokens := self tokenizeLine: (( line := self getLine) isNil ifTrue: [ ^self class connectionSignal raise] ifFalse: [ line ]). code := tokens first. messageStream nextPutAll: (tokens at: 3). (self hasContinuation: tokens) ifTrue: [[(line := self getLine) isNil ifTrue: [ ^self class connectionSignal raise]. tokens := self tokenizeLine: line. self isLastLine: tokens] whileFalse: [ tokens last notNil ifTrue: [ messageStream cr; nextPutAll: tokens last]]. (tokens at: 3) notNil ifTrue: [messageStream cr; nextPutAll: (tokens at: 3)]]
responseEquals: threeDigitString ^code asNumber = threeDigitString asNumber
responseTypeIs: char ^code isEmpty not ifTrue: [ code first == char ]
tokenizeLine: aString "Answer 4-element array containing 3-character reply code, delimiter character, remainder of the string and the string itself" | answer | answer := Array new: 4. aString isNil ifTrue: [ ^answer ]. ^[answer at: 4 put: aString; at: 1 put: (aString copyFrom: 1 to: 3); at: 2 put: (aString at: 4); at: 3 put: (aString copyFrom: 5 to: aString size); yourself] on: Object subscriptOutOfBoundsSignal do: [:ex | ex return: answer]
</methods> <methods> Net.NetworkResponse <category>accessing</category>
code ^code
codeAt: position " Answer character at specified position inside the status code " ^code at: position
message ^messageStream contents
status " Answer code as a number " ^code notNil ifTrue: [ Integer readFrom: code readStream] ifFalse: [ 0 ]
statusAt: position " Answer digit value of status code at a specified position " ^(self codeAt: position) digitValue
stream ^stream
stream: aStream stream := aStream
</methods> <methods> Net.NetworkResponse <category>initialization</category>
initialize code = ''. messageStream := (String new: 64) writeStream.
</methods> <methods> Net.NetworkResponse <category>comparing</category>
= other ^code = other code
</methods> <methods> Net.NetworkResponse <category>instance creation</category>
readFrom: aStream self initialize. self stream: aStream. self readResponse.
</methods> <methods> Net.NetworkResponse <category>testing</category>
isSuccess "Success - The action was received, understood and accepted" ^self responseTypeIs: $2
isUnknownError ^code isEmpty not ifTrue: [ ('12345' includes: code first) not ]
</methods> <methods> Net.NetworkResponse class <category>constants</category>
continuationToken ^$-
terminationToken ^Character space
</methods> <methods> Net.NetworkResponse class <category>instance creation</category>
new ^super new initialize
readFrom: aStream ^self new readFrom: aStream
</methods> <methods> Net.NetworkResponse class <category>signals</category>
connectionSignal ^Error
</methods> <methods> Net.NetUser <category>accessing</category>
account ^account
account: aString account := aString
asText ^self fullName
fullName ^fullName
fullName: aString fullName := aString
mailAddress ^mailAddress
mailAddress: aString mailAddress := aString
name ^self username
password ^password
password: aString password := aString
savePassword ^savePassword
savePassword: aBoolean savePassword := aBoolean
username ^username
username: aString username := aString
</methods> <methods> Net.NetUser <category>update</category>
updateBy: aNetUser self fullName: aNetUser fullName; username: aNetUser username; account: aNetUser account; password: aNetUser password; mailAddress: aNetUser mailAddress; savePassword: aNetUser savePassword.
</methods> <methods> Net.NetUser <category>printing</category>
asString | stream | stream := (String new: 64) writeStream. self printOn: stream. ^stream contents
printDefaultOn: aStream aStream nextPutAll: (#Default << #net >> ' (Default) ') asString
printMailAddressOn: aStream self mailAddress notNil ifTrue: [ aStream nextPutAll: ' <', self mailAddress, '>'].
printNameOn: aStream self fullName notNil ifTrue: [ aStream nextPutAll: self fullName] ifFalse: [ aStream nextPutAll: self class name asString. username notNil ifTrue: [aStream space; nextPutAll: username; nextPutAll: (#PasswordConcealed << #net >> ' password (concealed)') asString]].
printOn: aStream self printNameOn: aStream. self isDefaultIdentity ifTrue: [ self printDefaultOn: aStream ]. self printMailAddressOn: aStream
specFrom: aDict aDict keysAndValuesDo: [ :key :value | self instVarAt: ( self class instVarIndexFor: key) put: (Compiler evaluate: value readStream)]
specString | stream value | stream := (String new: 128) writeStream. self class instVarNames do: [ :ins | (value := self instVarAt: ( self class instVarIndexFor: ins)) notNil ifTrue: [stream nextPutAll: ins, ' = ', value printString; cr]]. ^stream contents.
</methods> <methods> Net.NetUser <category>testing</category>
isDefaultIdentity ^Settings isDefaultIdentity: self
isHttpUser ^false
</methods> <methods> Net.NetUser class <category>accessing</category>
lastUser ^LastUser
</methods> <methods> Net.NetUser class <category>instance creation</category>
request "NetUser request" | username password cancel | username := (LastUser isNil ifTrue: [''] ifFalse: [LastUser]) asValue. password := '' asValue. cancel := (SimpleDialog initializedFor: nil) setInitialGap; addMessage: (#Username << #net >> 'Username') textLine: username boundary: 0.4; addGap; addMessage: (#Password << #net >> 'Password') textLine: password type: #password boundary: 0.4; addGap; addOK: [true]; openDialog; cancel. username value isEmpty ifFalse: [LastUser := username value]. cancel value ifTrue: [^nil]. ^self new username: username value; password: password value; yourself
request: label "NetUser request: ('Login to <1s> server <2s>' expandMacrosWith: 'POP3' with: 'sulu.cincom.com')" | username password cancel | username := (LastUser isNil ifTrue: [''] ifFalse: [LastUser]) asValue. password := '' asValue. cancel := (SimpleDialog initializedFor: nil) setInitialGap; addMessage: label centered: true; addGap; addMessage: (#Username << #net >> 'Username') textLine: username boundary: 0.4; addGap; addMessage: (#Password << #net >> 'Password') textLine: password type: #password boundary: 0.4; addGap; addOK: [true]; openDialog; cancel. username value isEmpty ifFalse: [LastUser := username value]. cancel value ifTrue: [^nil]. ^self new username: username value; password: password value; yourself
username: aUsername password: aPassword "PopUser username: 'foo' password: 'foo'" |user| user := self new. LastUser := aUsername. ^user fullName: aUsername; username: aUsername; password: aPassword; yourself
</methods> <methods> Net.NetClient <category>accessing</category>
clientPI ^clientPI isNil ifTrue: [clientPI := self protocolInterpreterClass new] ifFalse: [clientPI]
clientPI: anProtocolInterpreter clientPI := anProtocolInterpreter
connection ^self clientPI connection
delaySeconds delaySeconds isNil ifTrue: [ delaySeconds := self defaultDelaySeconds]. ^ delaySeconds
delaySeconds: aNumber delaySeconds := aNumber
hostName ^hostName
hostName: aString hostName := aString
password ^self user password
portNumber ^portNumber
portNumber: aNumber portNumber := aNumber
retries retries isNil ifTrue: [retries := self defaultRetries]. ^retries
retries: aNumber retries := aNumber
state ^state
state: aState state := aState. state client: self
timeout timeout isNil ifTrue: [ timeout := self defaultTimeout]. ^timeout
timeout: numberOfMilliseconds timeout := numberOfMilliseconds
user ^user
user: aNetUser user := aNetUser
username ^self user username
username: aString self user isNil ifTrue: [ self user: (NetUser new username: aString; yourself)] ifFalse: [ self user username: aString]
</methods> <methods> Net.NetClient <category>printing</category>
printOn: aStream aStream nextPutAll: 'a', self class name. self hostName notNil ifTrue: [aStream nextPutAll: ' on: '; nextPutAll: self hostName; nextPut: $:; nextPutAll: self portNumber printString].
</methods> <methods> Net.NetClient <category>defaults</category>
defaultDelaySeconds ^self class defaultDelaySeconds
defaultPortNumber ^self class defaultPortNumber
defaultRetries ^self class defaultRetries
defaultTimeout ^self class defaultTimeout
protocolInterpreterClass ^self class defaultProtocolInterpreterClass
</methods> <methods> Net.NetClient <category>debugging</category>
log: aString level: aLevel self class log: aString level: aLevel
</methods> <methods> Net.NetClient <category>initialize-release</category>
initialize clientPI := self protocolInterpreterClass new .
onNetConnection: aNetConnection self clientPI connection: aNetConnection
useDefaultConnection self clientPI useDefaultConnection
</methods> <methods> Net.NetClient <category>connection management</category>
close "client sign off and disconnect" self disconnect
connect "Establish a connection to the host" ^self clientPI connectToHost: self hostName port: self portNumber timeout: self timeout.
connectIfClosed self isConnected not ifTrue: [self connect ]
connectToHost: aString "Establish a connection to the host <aString>." self hostName: aString. self connect.
connectToHost: aString port: aNumber "Establish a connection to the host <aString>." self portNumber: aNumber. self connectToHost: aString
disconnect "Disconnect from the host" self clientPI disconnect.
isConnected ^self clientPI isConnected
login
loginAsUser: userString withPassword: passwdString "Login to the host using the specified user name <aString> and password<aString>" user := NetUser username: userString password: passwdString. self loginToHost
loginToHost "Login to the host" self login
loginToHost: aHostName asUser: userString withPassword: passwdString "Connect and login to the host <aString> using the specified user name<aString> and password<aString>" self connectToHost: aHostName. self loginAsUser: userString withPassword: passwdString.
loginToHost: aHostName port: aNumber asUser: userString withPassword: passwdString "Connect and login to the host <aString> using the specified user name<aString> and password<aString>" self connectToHost: aHostName port: aNumber. self loginAsUser: userString withPassword: passwdString.
reconnect "Reconnect to the host" self disconnect. self connect.
</methods> <methods> Net.NetClient <category>secure connection</category>
sslContext ^self clientPI sslContext
sslContext: anSSLContext self clientPI sslContext: anSSLContext
useSecureConnection self clientPI useSecureConnection
validationBlock ^self clientPI validationBlock
validationBlock: aBlock self clientPI validationBlock: aBlock
</methods> <methods> Net.NetClient <category>obsolete</category>
onStreamHandler: aNetConnection self onNetConnection: aNetConnection
</methods> <methods> Net.NetClient class <category>instance creation</category>
connectToHost: aHostname "Create NetClient object, establish a connection to the host <aString>" ^self new connectToHost: aHostname
connectToHost: aHostname port: aPort "Create NetClient object, establish a connection to the host <aString> and port <aString>" ^self new connectToHost: aHostname port: aPort
host: aHostname "Create NetClient object, set up the host <aString>" ^self new hostName: aHostname; yourself
host: aHostname port: aPort "Create NetClient object, set up the host <aString> and port <aString>" ^self new hostName: aHostname; portNumber: aPort; yourself
loginToHost: aHostName asUser: userString withPassword: passwdString "Create NetClient object, connect and login to the host <aString> using the specified user name<aString>& password<aString> " ^self new loginToHost: aHostName asUser: userString withPassword: passwdString
loginToHost: aHostName port: aNumber asUser: userString withPassword: passwdString "Create NetClient object, connect and login to the host <aString> using the specified user name<aString>, password<aString> & port <aNumber>" ^self new loginToHost: aHostName port: aNumber asUser: userString withPassword: passwdString
new ^super new initialize
onNetConnection: aNetConnection ^self new onNetConnection: aNetConnection; yourself
</methods> <methods> Net.NetClient class <category>defaults</category>
defaultDelaySeconds ^DefaultDelaySeconds isNil ifTrue: [ DefaultDelaySeconds := self defaultDelaySecondsValue ] ifFalse: [ DefaultDelaySeconds ]
defaultDelaySeconds: aNumber DefaultDelaySeconds := aNumber
defaultIncomingMailClient DefaultIncomingMailClient isNil ifTrue: [ self newDefaultIncomingMailClient ]. ^DefaultIncomingMailClient
defaultIncomingMailClient: aMailClient DefaultIncomingMailClient := aMailClient
defaultOutgoingMailClient DefaultOutgoingMailClient isNil ifTrue: [ self newDefaultOutgoingMailClient ]. ^DefaultOutgoingMailClient
defaultOutgoingMailClient: aMailClient DefaultOutgoingMailClient := aMailClient
defaultPortNumber ^self subclassResponsibility
defaultProtocolInterpreterClass ^defaultProtocolInterpreterClass ifNil: [defaultProtocolInterpreterClass := self defaultProtocolInterpreterClassValue]
defaultProtocolInterpreterClass: aClass defaultProtocolInterpreterClass := aClass
defaultRetries ^DefaultRetries isNil ifTrue: [ DefaultRetries := self defaultRetriesValue] ifFalse: [ DefaultRetries ]
defaultRetries: aNumber DefaultRetries := aNumber
defaultTimeout ^DefaultTimeout isNil ifTrue: [ DefaultTimeout := self defaultTimeoutValue ] ifFalse: [ DefaultTimeout ]
defaultTimeout: aNumber DefaultTimeout := aNumber
</methods> <methods> Net.NetClient class <category>reset defaults</category>
resetDefaultIncomingMailClient DefaultIncomingMailClient := nil.
resetDefaultOutgoingMailClient DefaultOutgoingMailClient := nil.
resetDefaults self resetDefaultIncomingMailClient; resetDefaultOutgoingMailClient.
</methods> <methods> Net.NetClient class <category>class initialization</category>
initialize "self initialize" ( self netSettings dependents includes: self ) ifFalse: [ self netSettings addDependent: self ]. self registerClass.
obsolete "Break dependencies" [self netSettings dependents includes: self] whileTrue: [self netSettings removeDependent: self]. ^super obsolete
</methods> <methods> Net.NetClient class <category>testing</category>
isIncomingMailClient ^false
isMailClient ^false
</methods> <methods> Net.NetClient class <category>registry</category>
mailRegistry ^MailRegistry isNil ifTrue: [ MailRegistry := IdentityDictionary new] ifFalse: [ MailRegistry ]
netSettings ^Settings
registerClass
registerClass: aClass self mailRegistry at: aClass serverType put: aClass name
</methods> <methods> Net.NetClient class <category>private</category>
loadParcelDialog: aText host: host ^Dialog warn: ((#SupportParcelShouldBeLoaded << #net >> 'To create <1s> <n><2s>Support parcel should be loaded!') expandMacrosWith: aText with: host type)
newDefaultIncomingMailClient | client host | (host := self netSettings defaultIncomingHost ) notNil ifTrue: [ ( client := self mailRegistry at: host type asSymbol ifAbsent: [nil]) isNil ifTrue: [ self loadParcelDialog: (#defaultIncomingMailClient << #net >> 'default incoming mail client') host: host] ifFalse: [ DefaultIncomingMailClient := (LiteralBindingReference pathString: 'Net.',client) value new hostName: host name; portNumber: host port; user: host netUser; yourself.]] ifFalse: [ self updateSettingsDialog: (#defaultIncomingMailServer << #net >> 'default incoming mail server')]
newDefaultOutgoingMailClient | client host | (host := self netSettings defaultOutgoingHost) notNil ifTrue: [ ( client := self mailRegistry at: host type asSymbol ifAbsent: [nil]) isNil ifTrue: [ self loadParcelDialog: (#defaultOutgoingMailClient << #net >> 'default outgoing mail client') host: host] ifFalse: [ DefaultOutgoingMailClient := (LiteralBindingReference pathString: 'Net.',client) value new hostName: host name; portNumber: host port; user: host netUser; yourself.]] ifFalse: [ self updateSettingsDialog: (#defaultOutgoingMailServer << #net >> 'default outgoing mail server')]
update: anAspect with: arguments from: anObject anAspect == #changedDefaultOutgoingServer ifTrue: [self resetDefaultOutgoingMailClient]. anAspect == #changedDefaultIncomingServer ifTrue: [self resetDefaultIncomingMailClient]. anAspect == #returnFromSnapshot ifTrue: [self resetDefaults ].
updateSettingsDialog: aText ^Dialog warn: ((#YouNeedToUpdateNetworkSetting << #net >> 'You need to update Tools-%>Network Setting.. for <1s>') expandMacrosWith: aText)
</methods> <methods> Net.NetClient class <category>constants</category>
description ^''
serverType
</methods> <methods> Net.NetClient class <category>debugging</category>
debugLabelsAndValues ^OrderedCollection new add: ((#NetClientMessages << #net >> 'Net Client Messages')->#NetClient); yourself
log: aString level: aLevel #{Tools.LogEnvironment} ifDefinedDo: [ :le | le default log: aString level: aLevel ]
menuItemName ^(#NetClientMessages << #net >> 'Net Client Messages')
registerToDebug #{Tools.LogEnvironment} ifDefinedDo: [ :le | le default addToDebug: self ]
</methods> <methods> Net.NetClient class <category>default values</category>
defaultDelaySecondsValue ^10
defaultProtocolInterpreterClassValue ^NetProtocolInterpreter
defaultRetriesValue ^5
defaultTimeoutValue ^20000
</methods> <methods> Net.NetClient class <category>obsolete</category>
onStreamHandler: aNetConnection ^self onNetConnection: aNetConnection
</methods> <methods> Core.InternalStream <category>accessing</category>
asEncodedStreamWithEncoding: aSymbol lineEndConvention: aNumber | stream | stream := self. stream isCharacterStream ifTrue: [ stream := Protocols.DecodedStream on: stream encodedBy: (StreamEncoder new: aSymbol). stream lineEndConvention: aNumber. stream encoder errorPolicy: Net.ReplaceUnsupportedCharacters new]. stream := EncodedStream on: stream encodedBy: (StreamEncoder new: aSymbol). stream lineEndConvention: aNumber. stream encoder errorPolicy: Net.ReplaceUnsupportedCharacters new. ^stream
</methods> <methods> Core.InternalStream <category>Mime -- testing</category>
isByteStream ^self isCharacterStream not
isCharacterStream ^collection class inheritsFrom: CharacterArray
isInternal ^true
</methods> <methods> Core.EncodedStream <category>net extensions</category>
from: start to: end ^self newSize: end - start startingAt: start
isByteStream ^self isBinary
isCharacterStream ^self isByteStream not
</methods> <methods> Core.EncodedStream <category>testing</category>
isSegmented ^stream isSegmented
</methods> <methods> Core.EncodedStream <category>net extensions</category>
newSize: anInteger ^self newSize: anInteger startingAt: self position
newSize: anInteger startingAt: offset ^(self class on: (stream newSize: anInteger startingAt: offset) encodedBy: (StreamEncoder new: encoder encoding) ) lineEndConvention: lineEndConvention; setBinary: self isBinary; policy: policy; "hope it's ok to share that" yourself
</methods> <methods> Core.PositionableStream <category>Mime -- stream segments</category>
from: start to: end ^self newSize: end - start startingAt: start
newSize: anInteger ^self newSize: anInteger startingAt: self position
newSize: anInteger startingAt: offset ^Net.StreamSegment on: self offset: offset size: anInteger
</methods> <methods> Core.Stream <category>accessing</category>
asEncodedStreamWithEncoding: aSymbol lineEndConvention: aNumber "This is here so that it doesn't have to be duplicated between EncodedStream and ExternalStream" | stream isBinary | (self lineEndConvention = aNumber and: [ (StreamEncoder new: aSymbol) encoding = self encoding ]) ifTrue: [^self]. "If the arguments don't match the receiver we need an adaptation layer" isBinary := self isBinary. self text. "decoded stream needs characters" stream := Protocols.DecodedStream on: self encodedBy: (StreamEncoder new: aSymbol). stream lineEndConvention: aNumber. stream encoder errorPolicy: Net.ReplaceUnsupportedCharacters new. stream := EncodedStream on: stream encodedBy: (StreamEncoder new: aSymbol). stream lineEndConvention: aNumber. stream encoder errorPolicy: Net.ReplaceUnsupportedCharacters new. stream setBinary: isBinary. ^stream
</methods> <methods> Core.Stream <category>Mime -- stream segments</category>
asStream ^self
</methods> <methods> Core.Stream <category>Mime -- testing</category>
isInternal ^false
</methods> <methods> Core.Stream <category>testing</category>
isSegmented ^false
</methods> <methods> Core.Stream <category>Mime -- enumerating lines</category>
linesDo: aBlock " Enumerate stream line by line " [self atEnd] whileFalse: [aBlock value: self nextLine]
</methods> <methods> Core.Stream <category>accessing</category>
nextLine ^self upTo: Character cr
</methods> <methods> Core.Text <category>accessing</category>
concreteIndexFor: charIndex ^string concreteIndexFor: charIndex
concreteString ^string concreteString
stringEncoding ^string stringEncoding
</methods> <methods> OS.BufferedExternalStream <category>accessing</category>
encoding ^bufferType encoder streamEncodingType
</methods> <methods> OS.BufferedExternalStream <category>character/binary</category>
isByteStream ^self isBinary
isCharacterStream ^self isByteStream not
</methods> <methods> OS.BufferedExternalStream <category>accessing</category>
segmentLineEndSize ^self lineEndConvention = LineEndCRLF ifTrue: [2] ifFalse: [1]
</methods> <initialize> Net.MimeTypeDescriptor </initialize> <initialize> Net.SimpleScanner </initialize> <initialize> Net.INIScanner </initialize> <initialize> Net.Settings </initialize> <initialize> Net.UTF7StreamEncoder </initialize> <initialize> Net.NetClient </initialize> "Imported Classes:" self error: 'Attempting to file-in parcel imports. Choose terminate or close' <class> <name>Object</name> <environment>Core</environment> <super></super> <private>false</private> none <imports></imports> <category>Kernel-Objects</category> <attributes> <package>Kernel-Objects</package> </attributes> </class> <class> <name>Text</name> <environment>Core</environment> <super>Core.CharacterArray</super> <private>false</private> none string runs <imports> private Graphics.TextConstants.* </imports> <category>Collections-Text</category> <attributes> <package>Collections-Text</package> </attributes> </class> <class> <name>Stream</name> <environment>Core</environment> <super>Core.Object</super> <private>false</private> none <imports> private IOConstants.* </imports> <category>Collections-Streams</category> <attributes> <package>Collections-Streams</package> </attributes> </class> <class> <name>PositionableStream</name> <environment>Core</environment> <super>Core.PeekableStream</super> <private>false</private> none collection position readLimit writeLimit policy <imports></imports> <category>Collections-Streams</category> <attributes> <package>Collections-Streams</package> </attributes> </class> <class> <name>Base64StreamEncoder</name> <environment>Protocols</environment> <super>Core.StreamEncoder</super> <private>false</private> none index nibble nEncoded sextetMap octetMap <imports></imports> <category>Net-Clients</category> <attributes> <package>Protocols-Common</package> </attributes> </class> <class> <name>BufferedExternalStream</name> <environment>OS</environment> <super>OS.ExternalStream</super> <private>false</private> none lineEndCharacter binary lineEndConvention bufferType ioBuffer ioConnection <imports> private OS.IOConstants.* </imports> <category>OS-Streaming</category> <attributes> <package>OS-Streaming</package> </attributes> </class> <class> <name>InternalStream</name> <environment>Core</environment> <super>Core.PositionableStream</super> <private>false</private> none <imports></imports> <category>Collections-Streams</category> <attributes> <package>Collections-Streams</package> </attributes> </class> <class> <name>IllegalCharacterStreamErrorPolicy</name> <environment>Core</environment> <super>Core.StreamErrorPolicy</super> <private>false</private> none <imports></imports> <category>Collections-Streams</category> <attributes> <package>Collections-Streams</package> </attributes> </class> <class> <name>Notification</name> <environment>Core</environment> <super>Core.Exception</super> <private>false</private> none <imports></imports> <category>Kernel-Exception Handling</category> <attributes> <package>Kernel-Exception Handling</package> </attributes> </class> <class> <name>EncodedStream</name> <environment>Core</environment> <super>Core.PeekableStream</super> <private>false</private> none binary stream encoder policy lineEndConvention lineEndCharacter skipSize <imports> private OS.IOConstants.* </imports> <category>Collections-Streams</category> <attributes> <package>Collections-Streams</package> </attributes> </class> <class> <name>Error</name> <environment>Core</environment> <super>Core.Exception</super> <private>false</private> none <imports></imports> <category>Kernel-Exception Handling</category> <attributes> <package>Kernel-Exception Handling</package> </attributes> </class>