On 7/25/07, Stefano Bagnara <[EMAIL PROTECTED]> wrote:
Robert Burrell Donkin ha scritto:
<snip>
> 2. there are currently some methods which seem like they may be > stateful. for example, it's not certain how to interpret > advanceToBoundary if boundary has not previously been set. the > question is whether to specify reasonable behaviour (for example, when > the boundary has not been set, advancedToBoundary should do nothing) > or insist that exceptions be thrown. I'd go for an exception. But I don't know the code enough to understand how likely this will happen and how likely this is a programmer error or something else.
AFAICT it would be an implementation error state is maintained in both the pull parser and the cursor the cursor needs to understand whether it is within a part in a mime message or within not since the input stream reads only within a part. the pull parser also records this information. would probably be cleaner to maintain this is one place. ideas welcomed.
> 3. the API uses a string to represent the MIME boundary. i'm not sure > that this is right. AIUI (hopefully people will correct me if i'm > wrong) this can only be 8 bit ASCII characters. in general, passing a > string should mean worrying about encoding. realistically, the string > will just be stripped to it's low order bytes. > > - robert Why 8 bit ASCII ? Shouldn't it be 7 bit ASCII? The first 7 bit of the US-ASCII should be present in every encoding, right?
sorry: forgot that 7-bit, 8-bit has special meaning in the email context AIUI the boundary consists of ASCII each encoded as one 8-bit byte with one clean bit. java strings (and chars) are UNICODE. this is usually encoded as two 8-bit bytes (no clean bits), one 16-bit byte (no clean bits) or variable (one, two or three) 8-bit bytes. accepting a string might require a byte in the input to be decoded to a char then encoded to a byte to be used to compare the boundary. an alternative strategy would be to push enough intelligence into the cursor for it to be able to work out MIME and header boundaries for itself. - robert --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
