ByteString
is a String
and a ByteArray
, which can do all
kinds of nice string-like things.
Requesting a substring
of a ByteString
results in a
ByteSubstring
to be returned. This will mimic a ByteString
as
much as possible, including hashing, equality, uniquing, printing,
copying, etc, but they do not share a common superclass between
String
and ByteString
.
In the future, the ByteString
instance actual functionality could be
put into a ByteFullstring
, enabling the ByteSubstring
to actually
become a subclass of ByteString
...
static CharacterEncoding default_encoding;
ByteString
instances.
Never refer this variable directly; always ask the string (even if
it is self
) for its encoding
. A normal ByteString
will then
return this default_encoding
.
OutputStream help OutputStream s done MutableKeyed done;
ByteString
unit arguments.
void load MutableArray arguments;
iso-8859-1
will be used.
Before this method is invoked by the runtime library, the
default_encoding
will be a USASCIIEncoding
.
void switchToEncoding String name;
name
, moaning if it fails (without
changing the current encoding).
char at int index;
index
.
(pointer, int) byteStringContents;
boolean equal String other;
int hashRange (int, int) (start, len);
boolean equalByteString ByteString other;
boolean equalCharString CharString other;
boolean equalUniqueString UniqueString other;
protected id (self) init (pointer, int) (p, num);
num
bytes at p
.
The receiving instance will `own' the memory at p
.
id (self) initCopy (pointer, int) (p, num);
num
bytes at p
.
MutableByteString mutableSubstring (int, int) (start, len);
mutableCopyClass
,
initialized with a substring from the receiver's range (start, len)
.
String substring (int, int) (start, len);
UniqueByteString uniqueString;
OutputStream write OutputStream s;
class (State) mutableCopyClass;
MutableByteString
class.
CharacterEncoding encoding;
ByteString
. The default
implementation returns the default_encoding
.
String stringByDecoding String encoding_name;
String stringByDemapping CharArray demap;
boolean isAlpha byte b;
TRUE
the character denoted by the byte b
in the encoding
of the receiving string is a letter.
boolean isDigit byte b;
TRUE
the character denoted by the byte b
in the encoding
of the receiving string is a digit.
boolean isLower byte b;
TRUE
the character denoted by the byte b
in the encoding
of the receiving string is a lowercase letter.
boolean isPunct byte b;
TRUE
the character denoted by the byte b
in the encoding
of the receiving string is a punctuation character.
boolean isSpace byte b;
TRUE
the character denoted by the byte b
in the encoding
of the receiving string is a space character.
boolean isUpper byte b;
TRUE
the character denoted by the byte b
in the encoding
of the receiving string is a uppercase letter.
byte toLower byte b;
b
, according to the
encoding of the receiving string. If the character is not in
upper-case, it is returned unharmed.
byte toUpper byte b;
b
, according to the
encoding of the receiving string. If the character is not in
lower-case, it is returned unharmed.
int digitValue byte b;
b
, for which this string
should return TRUE
when asked isDigit
.
int alphaValue byte b;
b
relative to the start of its
letter range. Thus, 'a' returns 0, 'f' returns 5, etc.
id downcase;
downcase
overrides the implementation by String
,
since this one is faster due to avoiding the unnecessary conversion
to/from Unicode.
id upcase;
downcase
, this just is a faster implementation than the one
provided by String
.