Package org.jruby.util
Class ByteList
java.lang.Object
org.jruby.util.ByteList
- All Implemented Interfaces:
Serializable
,CharSequence
,Comparable
ByteList is simple a collection of bytes in the same way a Java String is a collection
of characters. However, its API resembles StringBuffer/StringBuilder more than String
because it is a mutable object.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionint
Deprecated.byte[]
Deprecated.static final ByteList
static final byte[]
int
Deprecated. -
Constructor Summary
ConstructorsConstructorDescriptionByteList()
Creates a new instance of ByteListByteList
(byte[] wrap) Create a new instance of ByteList with the contents of wrap.ByteList
(byte[] wrap, boolean copy) Create a new instance of ByteList with the contents of wrap.ByteList
(byte[] wrap, int index, int len) Create a new instance of ByteList using wrap as a backing store where index is the first index in the byte array where the data starts and len indicates how long the data portion of the bytelist is.ByteList
(byte[] wrap, int index, int len, boolean copy) Create a new instance of ByteList using wrap as a backing store where index is the first index in the byte array where the data starts and len indicates how long the data portion of the bytelist is.ByteList
(byte[] wrap, int index, int len, org.jcodings.Encoding encoding, boolean copy) Create a new instance of ByteList using wrap as a backing store where index is the first index in the byte array where the data starts and len indicates how long the data portion of the bytelist is.ByteList
(byte[] bytes, org.jcodings.Encoding encoding) Create a new instance of ByteList with the bytes supplied using the specified encoding.ByteList
(byte[] wrap, org.jcodings.Encoding encoding, boolean copy) Create a new instance of ByteList with the contents of wrap.ByteList
(int size) Creates a new instance of Bytelist with a pre-allocated size.ByteList
(int size, org.jcodings.Encoding enc) Creates a new instance of Bytelist with a pre-allocated size and specified encoding.Create a new instance of byte list with the same contents as the passed in ByteList wrap.Create a new instance of ByteList using wrap as a backing store where index is the first index in the byte array where the data starts and len indicates how long the data portion of the bytelist is. -
Method Summary
Modifier and TypeMethodDescriptionappend
(byte b) Append a single byte to the ByteListvoid
append
(byte[] moreBytes) Append moreBytes onto the end of the current ByteList.void
append
(byte[] moreBytes, int start, int len) Append moreBytes onto the end of the current ByteList with start as the new begin for len bytes from the moreBytes byte array.append
(int b) Append a single byte to the ByteList by truncating the given intappend
(InputStream input, int len) Append up to length bytes from InputStream to the ByteList.void
append
(ByteBuffer buffer, int len) Append contents of the supplied nio ByteList up to len length onto the end of this ByteBuffer.void
Append moreBytes onto the end of the current ByteList.void
Append moreBytes onto the end of the current ByteList with +index as the new begin for len bytes from the moreBytes ByteList.int
begin()
First index of the backing array that contains data for the ByteList.byte[]
bytes()
Get a copy of the bytes referenced by this ByteList.int
caseInsensitiveCmp
(ByteList other) Do a case insensitive comparison with other ByteList with return types similiar to compareTo.char
charAt
(int ix) Pretend byte array is raw and each byte is also the character valueclone()
int
This comparison matches MRI comparison of Strings (rb_str_cmp).int
This comparison matches MRI comparison of Strings (rb_str_cmp).static ByteList
Create a bytelist with ISO_8859_1 encoding from the provided CharSequence.static String
Decode byte data into a String with the supplied charsetName.static String
Decode byte data into a String with the supplied charsetName.void
delete
(int start, int len) Delete len bytes from start index.dup()
creates a duplicate of this bytelist but only in the case of a stringValue and its resulting hash value.dup
(int length) static byte[]
encode
(CharSequence data, String charsetName) Encode CharSequence into a set of bytes based on the charsetName.boolean
Does this ByteList end with the supplied ByteList?void
ensure
(int length) Ensure that the bytelist is at least length bytes long.boolean
Does this ByteList equal the other ByteList?boolean
Does this ByteList equal the other ByteList?void
fill
(int b, int len) Append the byte b up to len times onto the end of the current ByteList.int
get
(int index) Get the byte at index from the ByteList.int
getBegin()
int
getEnc
(int index) Get the index code point in this ByteList.org.jcodings.Encoding
int
byte[]
int
hashCode()
int
indexOf
(int c) Get the index of first occurrence of c in ByteList from the beginning of the ByteList.int
indexOf
(int c, int pos) Get the index of first occurrence of c in ByteList from the pos offset of the ByteList.int
Get the index of first occurrence of Bytelist find in this ByteList.int
Get the index of first occurrence of Bytelist find in this ByteList starting at index i.void
insert
(int index, int b) void
Invalidate the hash and stringValue which may have been cached in this ByteList.boolean
isEmpty()
Return true if the ByteList has zero length (byte length).int
lastIndexOf
(int c) Get the index of last occurrence of c in ByteList from the end of the ByteList.int
lastIndexOf
(int c, int pos) Get the index of last occurrence of c in ByteList from the pos offset of the ByteList.int
lastIndexOf
(ByteList find) Get the index of last occurrence of find in ByteList from the end of the ByteList.int
lastIndexOf
(ByteList find, int pos) Get the index of last occurrence of find in ByteList from the end of the ByteList.int
length()
Return the current length of the ByteList.void
length
(int newLength) Set the byte container length.int
Number of characters in this ByteList based on its current encoding.makeShared
(int index, int len) Make a shared copy of this ByteList.static int
memcmp
(byte[] first, int firstStart, byte[] second, int secondStart, int len) Are these two byte arrays similiar (semantics similiar to compareTo).static int
memcmp
(byte[] first, int firstStart, int firstLen, byte[] second, int secondStart, int secondLen) Are these two byte arrays similiar (semantics similiar to compareTo).static char[]
plain
(byte[] b) Create a char[] from a byte[] assuming a raw/ISO-8859-1 encodingstatic char[]
plain
(byte[] b, int start, int length) Create a char[] from a byte[] assuming a raw/ISO-8859-1 encodingstatic byte[]
plain
(char[] s) Create a byte[] from a char[] assuming a raw/ISO-8859-1 encodingstatic byte[]
Create a byte[] from a CharSequence assuming a raw/ISO-8859-1 encodingvoid
prepend
(byte b) Prepend a byte onto the front of this ByteList.void
realloc
(int length) Resize the ByteList's backing store to be length in size.int
realSize()
void
realSize
(int realSize) void
replace
(byte[] source) Replace all bytes in this ByteList with bytes from the given array.void
replace
(int targetOff, int targetLen, byte[] source) Replace a region of bytes in this ByteList with bytes from the given array.void
replace
(int targetOff, int targetLen, byte[] source, int sourceOff, int sourceLen) Replace a region of bytes in this ByteList with a region of bytes from the given array.void
Replace a region of bytes in this ByteList with bytes from the given ByteList.static org.jcodings.Encoding
safeEncoding
(org.jcodings.Encoding incoming) Ensure the encoding is always non-null.boolean
sample_equals
(Object other) an alternative to the new version of equals, should detect inequality faster (in many cases), but is slow in the case of equal values (all bytes visited), due to using n+=2, n-=2 vs.void
set
(int index, int b) Set the byte at index to be new value.void
setBegin
(int begin) void
setEncoding
(org.jcodings.Encoding encoding) void
setRealSize
(int realSize) void
setUnsafeBytes
(byte[] bytes) Create a new ByteList but do not array copy the byte backing store.boolean
startsWith
(ByteList other) Does this ByteList start with the supplied ByteList?boolean
startsWith
(ByteList other, int toffset) subSequence
(int start, int end) Create subSequence of this array between start and end offsetsProduce a String using the raw (ISO-8859-1) bytes of this ByteList.toString()
Remembers toString value, which is expensive for StringBuffer.byte[]
Returns the internal byte array.void
unsafeReplace
(int beg, int len, byte[] buf) Unsafe version of replace(int,int,byte[]).void
unsafeReplace
(int beg, int len, byte[] nbytes, int index, int count) Unsafe version of replace(int,int,byte[],int,int).void
unsafeReplace
(int beg, int len, ByteList nbytes) Unsafe version of replace(int,int,ByteList).void
unshare()
Array copy the byte backing store so that you can guarantee that no other objects are referencing this objects backing store.void
unshare
(int length) Array copy the byte backing store so that you can guarantee that no other objects are referencing this objects backing store.void
view
(int index, int len) Change ByteBuffer to have a new begin that is +index positions past begin with a new length.Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.CharSequence
chars, codePoints
-
Field Details
-
NULL_ARRAY
public static final byte[] NULL_ARRAY -
EMPTY_BYTELIST
-
bytes
Deprecated. -
begin
Deprecated. -
realSize
Deprecated.
-
-
Constructor Details
-
ByteList
public ByteList()Creates a new instance of ByteList -
ByteList
public ByteList(int size) Creates a new instance of Bytelist with a pre-allocated size. If you know the size ahead of time this saves additional array allocations to grow the bytelist to the proper size.- Parameters:
size
- to preallocate the bytelist to
-
ByteList
public ByteList(int size, org.jcodings.Encoding enc) Creates a new instance of Bytelist with a pre-allocated size and specified encoding. SeeByteList(int)
- Parameters:
size
- to preallocate the bytelist toenc
- encoding to set
-
ByteList
public ByteList(byte[] bytes, org.jcodings.Encoding encoding) Create a new instance of ByteList with the bytes supplied using the specified encoding. Important: bytes is used as the initial backing store for the bytelist. Over time as the bytelist is mutated this backing store may be replaced with a new one to hold the additional bytes. If you pass in bytes and then modify the contents of the original bytes, then those changes will get reflected.- Parameters:
bytes
- to useencoding
-
-
ByteList
public ByteList(byte[] wrap) Create a new instance of ByteList with the contents of wrap. This constructor will make a copy of bytes passed- Parameters:
wrap
- the initial bytes for this ByteList
-
ByteList
public ByteList(byte[] wrap, boolean copy) Create a new instance of ByteList with the contents of wrap. If copy is true then it will array copy the contents. Otherwise it will use the byte array passed in as its initial backing store.- Parameters:
wrap
- the initial bytes for this ByteListcopy
- whether to arraycopy wrap for the backing store or not
-
ByteList
public ByteList(byte[] wrap, org.jcodings.Encoding encoding, boolean copy) Create a new instance of ByteList with the contents of wrap. If copy is true then it will array copy the contents. Otherwise it will use the byte array passed in as its initial backing store.- Parameters:
wrap
- the initial bytes for this ByteListencoding
- the encoding for the bytescopy
- whether to arraycopy wrap for the backing store or not
-
ByteList
Create a new instance of byte list with the same contents as the passed in ByteList wrap. Note that this does array copy the data for the new objects initial backing store.- Parameters:
wrap
- is contents for new ByteList
-
ByteList
public ByteList(byte[] wrap, int index, int len) Create a new instance of ByteList using wrap as a backing store where index is the first index in the byte array where the data starts and len indicates how long the data portion of the bytelist is. wrap will be array copied in this constructor.- Parameters:
wrap
- the bytes to useindex
- where in the bytes the data startslen
- how long the data is in the wrap array
-
ByteList
public ByteList(byte[] wrap, int index, int len, boolean copy) Create a new instance of ByteList using wrap as a backing store where index is the first index in the byte array where the data starts and len indicates how long the data portion of the bytelist is. wrap will be array copied if copy is true OR if index != 0.- Parameters:
wrap
- the bytes to useindex
- where in the bytes the data startslen
- how long the data is in the wrap arraycopy
- if true array copy wrap. otherwise use as backing store
-
ByteList
public ByteList(byte[] wrap, int index, int len, org.jcodings.Encoding encoding, boolean copy) Create a new instance of ByteList using wrap as a backing store where index is the first index in the byte array where the data starts and len indicates how long the data portion of the bytelist is. wrap will be array copied if copy is true OR if index != 0.- Parameters:
wrap
- the bytes to useindex
- where in the bytes the data startslen
- how long the data is in the wrap arraycopy
- if true array copy wrap. otherwise use as backing store
-
ByteList
Create a new instance of ByteList using wrap as a backing store where index is the first index in the byte array where the data starts and len indicates how long the data portion of the bytelist is. wrap's byte array will be array copied for initial backing store.- Parameters:
wrap
- the bytes to useindex
- where in the bytes the data startslen
- how long the data is in the wrap array
-
-
Method Details
-
delete
public void delete(int start, int len) Delete len bytes from start index. This does no bullet-proofing so it is your responsibility to ensure you do not run off the backing store array.- Parameters:
start
- index to delete fromlen
- number of bytes to delete
-
fill
public void fill(int b, int len) Append the byte b up to len times onto the end of the current ByteList.- Parameters:
b
- is byte to be appendedlen
- is number of times to repeat the append
-
clone
-
dup
creates a duplicate of this bytelist but only in the case of a stringValue and its resulting hash value. No other elements are duplicated. -
shallowDup
Create a new ByteList but do not array copy the byte backing store.- Returns:
- a new ByteList with same backing store
-
dup
- Parameters:
length
- is the value of how big the buffer is going to be, not the actual length to copy It is used by RubyString.modify(int) to prevent COW pathological situations (namely to COW with havinglength - realSize
bytes ahead)
-
ensure
public void ensure(int length) Ensure that the bytelist is at least length bytes long. Otherwise grow the backing store so that it is at least length bytes long, but grow to 1.5 * length, if we're able to, to avoid thrashing.- Parameters:
length
- to use to make sure ByteList is long enough
-
view
public void view(int index, int len) Change ByteBuffer to have a new begin that is +index positions past begin with a new length.- Parameters:
index
- new value to add to beginlen
- the new realSize/length value
-
invalidate
public void invalidate()Invalidate the hash and stringValue which may have been cached in this ByteList. -
prepend
public void prepend(byte b) Prepend a byte onto the front of this ByteList.- Parameters:
b
- is the byte to be prepended
-
append
Append a single byte to the ByteList- Parameters:
b
- the byte to be added- Returns:
- this instance
-
append
Append a single byte to the ByteList by truncating the given int- Parameters:
b
- the int to truncated and added- Returns:
- this instance
-
append
Append up to length bytes from InputStream to the ByteList. If no bytes are read from the stream then throw an IOException.- Parameters:
input
- the stream to read bytes fromlen
- how many bytes to try reading- Returns:
- this instance
- Throws:
IOException
- when no bytes are read
-
append
Append contents of the supplied nio ByteList up to len length onto the end of this ByteBuffer.- Parameters:
buffer
- to be appendedlen
- is number of bytes you hoping to get from the ByteBuffer
-
append
public void append(byte[] moreBytes) Append moreBytes onto the end of the current ByteList.- Parameters:
moreBytes
- to be added.
-
append
Append moreBytes onto the end of the current ByteList.- Parameters:
moreBytes
- to be added.
-
append
Append moreBytes onto the end of the current ByteList with +index as the new begin for len bytes from the moreBytes ByteList.- Parameters:
moreBytes
- to be added.index
- new index past current begin valuelen
- is the number of bytes to append from source ByteList
-
append
public void append(byte[] moreBytes, int start, int len) Append moreBytes onto the end of the current ByteList with start as the new begin for len bytes from the moreBytes byte array.- Parameters:
moreBytes
- to be added.start
- is the new begin valuelen
- is the number of bytes to append from source byte array
-
realloc
public void realloc(int length) Resize the ByteList's backing store to be length in size. Note that this forces the backing store to array copy regardless of ByteLists current size or contents. It essentially will end any COWing.- Parameters:
length
- the new length for the backing store.
-
length
public int length()Return the current length of the ByteList.- Specified by:
length
in interfaceCharSequence
- Returns:
- the number of bytes in this ByteList.
-
isEmpty
public boolean isEmpty()Return true if the ByteList has zero length (byte length).- Specified by:
isEmpty
in interfaceCharSequence
- Returns:
- true if empty, false otherwise
-
length
public void length(int newLength) Set the byte container length.- Parameters:
newLength
-
-
lengthEnc
public int lengthEnc()Number of characters in this ByteList based on its current encoding.- Returns:
- number of characters
-
get
public int get(int index) Get the byte at index from the ByteList.- Parameters:
index
- to retreive byte from- Returns:
- the byte retreived
-
getEnc
public int getEnc(int index) Get the index code point in this ByteList.- Parameters:
index
- is the element you want- Returns:
- the element you requested
-
set
public void set(int index, int b) Set the byte at index to be new value.- Parameters:
index
- to set byteb
- is the new value.
-
unsafeReplace
Unsafe version of replace(int,int,ByteList). The contract is that these unsafe versions will not make sure thet beg and len indices are correct. -
unsafeReplace
public void unsafeReplace(int beg, int len, byte[] buf) Unsafe version of replace(int,int,byte[]). The contract is that these unsafe versions will not make sure thet beg and len indices are correct. -
unsafeReplace
public void unsafeReplace(int beg, int len, byte[] nbytes, int index, int count) Unsafe version of replace(int,int,byte[],int,int). The contract is that these unsafe versions will not make sure thet beg and len indices are correct. -
replace
public void replace(byte[] source) Replace all bytes in this ByteList with bytes from the given array.- Parameters:
source
- bytes to use for replacement
-
replace
Replace a region of bytes in this ByteList with bytes from the given ByteList.- Parameters:
targetOff
- offset of target region in this ByteListtargetLen
- length of target region in this ByteListsource
- ByteList to use for replacement
-
replace
public void replace(int targetOff, int targetLen, byte[] source) Replace a region of bytes in this ByteList with bytes from the given array.- Parameters:
targetOff
- offset of target region in this ByteListtargetLen
- length of target region in this ByteListsource
- bytes to use for replacement
-
replace
public void replace(int targetOff, int targetLen, byte[] source, int sourceOff, int sourceLen) Replace a region of bytes in this ByteList with a region of bytes from the given array.- Parameters:
targetOff
- offset of target region in this ByteListtargetLen
- length of target region in this ByteListsource
- bytes to use for replacementsourceOff
- offset of source region in the replacement bytessourceLen
- length of source region in the replacement bytes
-
insert
public void insert(int index, int b) -
indexOf
public int indexOf(int c) Get the index of first occurrence of c in ByteList from the beginning of the ByteList.- Parameters:
c
- byte to be looking for- Returns:
- the index of the byte or -1 if not found
-
indexOf
public int indexOf(int c, int pos) Get the index of first occurrence of c in ByteList from the pos offset of the ByteList.- Parameters:
c
- byte to be looking forpos
- off set from beginning of ByteList to look for byte- Returns:
- the index of the byte or -1 if not found
-
indexOf
Get the index of first occurrence of Bytelist find in this ByteList.- Parameters:
find
- the ByteList to find- Returns:
- the index of the byte or -1 if not found
-
indexOf
Get the index of first occurrence of Bytelist find in this ByteList starting at index i.- Parameters:
find
- the ByteList to findi
- the index to start from- Returns:
- the index of the byte or -1 if not found
-
lastIndexOf
public int lastIndexOf(int c) Get the index of last occurrence of c in ByteList from the end of the ByteList.- Parameters:
c
- byte to be looking for- Returns:
- the index of the byte or -1 if not found
-
lastIndexOf
public int lastIndexOf(int c, int pos) Get the index of last occurrence of c in ByteList from the pos offset of the ByteList.- Parameters:
c
- byte to be looking forpos
- off set from end of ByteList to look for byte- Returns:
- the index of the byte or -1 if not found
-
lastIndexOf
Get the index of last occurrence of find in ByteList from the end of the ByteList.- Parameters:
find
- ByteList to be looking for- Returns:
- the index of the byte or -1 if not found
-
lastIndexOf
Get the index of last occurrence of find in ByteList from the end of the ByteList.- Parameters:
find
- ByteList to be looking forpos
- index from end of list to search from- Returns:
- the index of the byte or -1 if not found
-
startsWith
-
startsWith
Does this ByteList start with the supplied ByteList?- Parameters:
other
- is the bytelist to compare with- Returns:
- true is this ByteList starts with other
-
endsWith
Does this ByteList end with the supplied ByteList?- Parameters:
other
- is the bytelist to compare with- Returns:
- true is this ByteList starts with other
-
equals
Does this ByteList equal the other ByteList? -
equal
Does this ByteList equal the other ByteList?- Parameters:
other
- is the bytelist to compare with- Returns:
- true is this ByteList is the same
-
sample_equals
an alternative to the new version of equals, should detect inequality faster (in many cases), but is slow in the case of equal values (all bytes visited), due to using n+=2, n-=2 vs. ++n, --n while iterating over the array. -
compareTo
This comparison matches MRI comparison of Strings (rb_str_cmp). I wish we had memcmp right now...- Specified by:
compareTo
in interfaceComparable
-
cmp
This comparison matches MRI comparison of Strings (rb_str_cmp). -
caseInsensitiveCmp
Do a case insensitive comparison with other ByteList with return types similiar to compareTo.- Parameters:
other
- the ByteList to compare- Returns:
- -1, 0, or 1
-
unsafeBytes
public byte[] unsafeBytes()Returns the internal byte array. This is unsafe unless you know what you're doing. But it can improve performance for byte-array operations that won't change the array.- Returns:
- the internal byte array
-
bytes
public byte[] bytes()Get a copy of the bytes referenced by this ByteList. It will make an optimal copy and not carry along unused bytes from COW sharing.- Returns:
- a copy of the bytes.
-
begin
public int begin()First index of the backing array that contains data for the ByteList. Note that we have copy-on-write (COW) semantics which means sharing the same backing store will yield different begin and size values while using the same byte[].- Returns:
- the index
-
hashCode
public int hashCode() -
toString
Remembers toString value, which is expensive for StringBuffer.- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classObject
- Returns:
- an ISO-8859-1 representation of the byte list
-
toByteString
Produce a String using the raw (ISO-8859-1) bytes of this ByteList.- Returns:
- a String based on the raw bytes
-
create
Create a bytelist with ISO_8859_1 encoding from the provided CharSequence.- Parameters:
s
- the source for new ByteList- Returns:
- the new ByteList
-
plain
Create a byte[] from a CharSequence assuming a raw/ISO-8859-1 encoding- Parameters:
s
- the CharSequence to convert- Returns:
- a byte[]
-
plain
public static byte[] plain(char[] s) Create a byte[] from a char[] assuming a raw/ISO-8859-1 encoding- Parameters:
s
- the CharSequence to convert- Returns:
- a byte[]
-
plain
public static char[] plain(byte[] b, int start, int length) Create a char[] from a byte[] assuming a raw/ISO-8859-1 encoding- Parameters:
b
- the source byte[]start
- index to start converting to char'slength
- how many bytes to convert to char's- Returns:
- a byte[]
-
plain
public static char[] plain(byte[] b) Create a char[] from a byte[] assuming a raw/ISO-8859-1 encoding- Parameters:
b
- the source byte[]- Returns:
- a byte[]
-
decode
Decode byte data into a String with the supplied charsetName.- Parameters:
data
- to be decodedoffset
- where to start decoding from in datalength
- how many bytes to decode from datacharsetName
- used to make the resulting String- Returns:
- the new String
-
decode
Decode byte data into a String with the supplied charsetName.- Parameters:
data
- to be decodedcharsetName
- used to make the resulting String- Returns:
- the new String
-
encode
Encode CharSequence into a set of bytes based on the charsetName.- Parameters:
data
- to be encodedcharsetName
- used to extract the resulting bytes- Returns:
- the new byte[]
-
charAt
public char charAt(int ix) Pretend byte array is raw and each byte is also the character value- Specified by:
charAt
in interfaceCharSequence
- Parameters:
ix
- is the index you want- Returns:
-
subSequence
Create subSequence of this array between start and end offsets- Specified by:
subSequence
in interfaceCharSequence
- Parameters:
start
- index for beginning of subsequenceend
- index for end of subsequence- Returns:
- a new ByteList/CharSequence
-
memcmp
public static int memcmp(byte[] first, int firstStart, int firstLen, byte[] second, int secondStart, int secondLen) Are these two byte arrays similiar (semantics similiar to compareTo). This is slightly special in that it will only compare the same number of bytes based on the lesser of the two lengths.- Returns:
- -1, 0, 1
-
memcmp
public static int memcmp(byte[] first, int firstStart, byte[] second, int secondStart, int len) Are these two byte arrays similiar (semantics similiar to compareTo).- Returns:
- -1, 0, 1
-
getUnsafeBytes
public byte[] getUnsafeBytes()- Returns:
- the bytes
-
setUnsafeBytes
public void setUnsafeBytes(byte[] bytes) - Parameters:
bytes
- the bytes to set
-
getBegin
public int getBegin()- Returns:
- the begin
-
setBegin
public void setBegin(int begin) - Parameters:
begin
- the begin to set
-
getRealSize
public int getRealSize()- Returns:
- the realSize
-
setRealSize
public void setRealSize(int realSize) - Parameters:
realSize
- the realSize to set
-
realSize
public int realSize()- Returns:
- the realSize
-
realSize
public void realSize(int realSize) - Parameters:
realSize
- the realSize to set
-
getEncoding
public org.jcodings.Encoding getEncoding()- Returns:
- the encoding
-
setEncoding
public void setEncoding(org.jcodings.Encoding encoding) - Parameters:
encoding
- the encoding to set
-
safeEncoding
public static org.jcodings.Encoding safeEncoding(org.jcodings.Encoding incoming) Ensure the encoding is always non-null.
-