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 TypeFieldDescriptionintDeprecated.byte[]Deprecated.static final ByteListstatic final byte[]intDeprecated. -
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 ByteListvoidappend(byte[] moreBytes) Append moreBytes onto the end of the current ByteList.voidappend(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.voidappend(ByteBuffer buffer, int len) Append contents of the supplied nio ByteList up to len length onto the end of this ByteBuffer.voidAppend moreBytes onto the end of the current ByteList.voidAppend moreBytes onto the end of the current ByteList with +index as the new begin for len bytes from the moreBytes ByteList.intbegin()First index of the backing array that contains data for the ByteList.byte[]bytes()Get a copy of the bytes referenced by this ByteList.intcaseInsensitiveCmp(ByteList other) Do a case insensitive comparison with other ByteList with return types similiar to compareTo.charcharAt(int ix) Pretend byte array is raw and each byte is also the character valueclone()intThis comparison matches MRI comparison of Strings (rb_str_cmp).intThis comparison matches MRI comparison of Strings (rb_str_cmp).static ByteListCreate a bytelist with ISO_8859_1 encoding from the provided CharSequence.static StringDecode byte data into a String with the supplied charsetName.static StringDecode byte data into a String with the supplied charsetName.voiddelete(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.booleanDoes this ByteList end with the supplied ByteList?voidensure(int length) Ensure that the bytelist is at least length bytes long.booleanDoes this ByteList equal the other ByteList?booleanDoes this ByteList equal the other ByteList?voidfill(int b, int len) Append the byte b up to len times onto the end of the current ByteList.intget(int index) Get the byte at index from the ByteList.intgetBegin()intgetEnc(int index) Get the index code point in this ByteList.org.jcodings.Encodingintbyte[]inthashCode()intindexOf(int c) Get the index of first occurrence of c in ByteList from the beginning of the ByteList.intindexOf(int c, int pos) Get the index of first occurrence of c in ByteList from the pos offset of the ByteList.intGet the index of first occurrence of Bytelist find in this ByteList.intGet the index of first occurrence of Bytelist find in this ByteList starting at index i.voidinsert(int index, int b) voidInvalidate the hash and stringValue which may have been cached in this ByteList.booleanisEmpty()Return true if the ByteList has zero length (byte length).intlastIndexOf(int c) Get the index of last occurrence of c in ByteList from the end of the ByteList.intlastIndexOf(int c, int pos) Get the index of last occurrence of c in ByteList from the pos offset of the ByteList.intlastIndexOf(ByteList find) Get the index of last occurrence of find in ByteList from the end of the ByteList.intlastIndexOf(ByteList find, int pos) Get the index of last occurrence of find in ByteList from the end of the ByteList.intlength()Return the current length of the ByteList.voidlength(int newLength) Set the byte container length.intNumber of characters in this ByteList based on its current encoding.makeShared(int index, int len) Make a shared copy of this ByteList.static intmemcmp(byte[] first, int firstStart, byte[] second, int secondStart, int len) Are these two byte arrays similiar (semantics similiar to compareTo).static intmemcmp(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 encodingvoidprepend(byte b) Prepend a byte onto the front of this ByteList.voidrealloc(int length) Resize the ByteList's backing store to be length in size.intrealSize()voidrealSize(int realSize) voidreplace(byte[] source) Replace all bytes in this ByteList with bytes from the given array.voidreplace(int targetOff, int targetLen, byte[] source) Replace a region of bytes in this ByteList with bytes from the given array.voidreplace(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.voidReplace a region of bytes in this ByteList with bytes from the given ByteList.static org.jcodings.EncodingsafeEncoding(org.jcodings.Encoding incoming) Ensure the encoding is always non-null.booleansample_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.voidset(int index, int b) Set the byte at index to be new value.voidsetBegin(int begin) voidsetEncoding(org.jcodings.Encoding encoding) voidsetRealSize(int realSize) voidsetUnsafeBytes(byte[] bytes) Create a new ByteList but do not array copy the byte backing store.booleanstartsWith(ByteList other) Does this ByteList start with the supplied ByteList?booleanstartsWith(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.voidunsafeReplace(int beg, int len, byte[] buf) Unsafe version of replace(int,int,byte[]).voidunsafeReplace(int beg, int len, byte[] nbytes, int index, int count) Unsafe version of replace(int,int,byte[],int,int).voidunsafeReplace(int beg, int len, ByteList nbytes) Unsafe version of replace(int,int,ByteList).voidunshare()Array copy the byte backing store so that you can guarantee that no other objects are referencing this objects backing store.voidunshare(int length) Array copy the byte backing store so that you can guarantee that no other objects are referencing this objects backing store.voidview(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, waitMethods 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 - realSizebytes 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:
lengthin 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:
isEmptyin 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:
compareToin 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:
toStringin interfaceCharSequence- Overrides:
toStringin 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:
charAtin interfaceCharSequence- Parameters:
ix- is the index you want- Returns:
-
subSequence
Create subSequence of this array between start and end offsets- Specified by:
subSequencein 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.
-