Package org.jruby.util.io
Class EncodingUtils
java.lang.Object
org.jruby.util.io.EncodingUtils
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classstatic interfacestatic interfaceFallback function to provide replacements for characters that fail to transcode. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final EncodingUtils.AbstractTranscodeFallbackstatic final intstatic final intprivate static final EncodingUtils.AbstractTranscodeFallbackprivate static final EncodingUtils.AbstractTranscodeFallbackprivate static final byte[](package private) static final intprivate static final EncodingUtils.AbstractTranscodeFallbackstatic final EncodingUtils.ResizeFunctionstatic final intprivate static final org.jcodings.Encodingprivate static final org.jcodings.Encoding(package private) static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.jcodings.Encodingascii8bitEncoding(Ruby runtime) static CharsetcharsetForEncoding(org.jcodings.Encoding enc) Get an appropriate Java Charset for the given Encoding.static intdecorateConvpath(ThreadContext context, IRubyObject convpath, int ecflags) static booleanDECORATOR_P(byte[] sname, byte[] dname) static org.jcodings.EncodingdefaultExternalEncoding(Ruby runtime) static org.jcodings.EncodingdefineDummyEncoding(ThreadContext context, byte[] name) static ByteListeconvAppend(ThreadContext context, org.jcodings.transcode.EConv ec, byte[] bytes, int start, int length, ByteList dst, int flags) static ByteListeconvAppend(ThreadContext context, org.jcodings.transcode.EConv ec, ByteList sByteList, ByteList dst, int flags) static voideconvArgs(ThreadContext context, IRubyObject[] args, byte[][] encNames, org.jcodings.Encoding[] encs, int[] ecflags_p, IRubyObject[] ecopts_p) static org.jcodings.EncodingeconvAsciicompatEncoding(org.jcodings.Encoding enc) static ByteListeconvByteConvert(ThreadContext context, org.jcodings.transcode.EConv ec, byte[] bytes, int start, int length, int flags) static voideconvCheckError(ThreadContext context, org.jcodings.transcode.EConv ec) static StringeconvDescription(ThreadContext context, byte[] sourceEncoding, byte[] destinationEncoding, int ecflags, String message) static org.jcodings.transcode.EConveconvInitByConvpath(ThreadContext context, IRubyObject convpath, byte[][] encNames, org.jcodings.Encoding[] encs) static RaiseExceptioneconvOpenExc(ThreadContext context, byte[] sourceEncoding, byte[] destinationEncoding, int ecflags) static org.jcodings.transcode.EConveconvOpenOpts(ThreadContext context, byte[] sourceEncoding, byte[] destinationEncoding, int ecflags, IRubyObject opthash) static inteconvOpts(ThreadContext context, IRubyObject opt, int ecflags) static inteconvPrepareOptions(ThreadContext context, IRubyObject opthash, IRubyObject[] opts, int ecflags) static inteconvPrepareOpts(ThreadContext context, IRubyObject opthash, IRubyObject[] opts) static ByteListeconvStrConvert(ThreadContext context, org.jcodings.transcode.EConv ec, ByteList src, int flags) static ByteListeconvSubstrAppend(ThreadContext context, org.jcodings.transcode.EConv ec, ByteList src, ByteList dst, int flags) static org.jcodings.EncodingencArg(ThreadContext context, IRubyObject encval, byte[][] name_p, org.jcodings.Encoding[] enc_p) static intencAscget(byte[] pBytes, int p, int e, int[] len, org.jcodings.Encoding enc) static booleanencAsciicompat(org.jcodings.Encoding enc) static IRubyObjectencAssociateIndex(IRubyObject obj, org.jcodings.Encoding encidx) static voidencCheckDuplication(ThreadContext context, byte[] name) static intencCodelen(ThreadContext context, int c, org.jcodings.Encoding enc) static intencCodepointLength(byte[] pBytes, int p, int e, int[] len_p, org.jcodings.Encoding enc) static intencCodepointLength(Ruby runtime, byte[] pBytes, int p, int e, int[] len_p, org.jcodings.Encoding enc) static intencCrStrBufCat(Ruby runtime, CodeRangeable str, byte[] ptrBytes, int ptr, int len, org.jcodings.Encoding ptrEnc, int ptr_cr) static intencCrStrBufCat(Ruby runtime, CodeRangeable str, ByteList ptr, org.jcodings.Encoding ptrEnc, int ptr_cr) static booleanencDummy(org.jcodings.Encoding enc) static org.jcodings.EncodingencGet(ThreadContext context, IRubyObject obj) static intencMbcput(int c, byte[] buf, int p, org.jcodings.Encoding enc) static intencMbcput(ThreadContext context, int c, byte[] buf, int p, org.jcodings.Encoding enc) static intencMbminlen(org.jcodings.Encoding encoding) static IRubyObjectencodedDup(ThreadContext context, IRubyObject newstr, IRubyObject str, org.jcodings.Encoding encindex) static booleanencodingEqual(byte[] enc1, byte[] enc2) encodingNames(byte[] name, int p, int end) static booleanencRegistered(byte[] name) static org.jcodings.EncodingencReplicate(ThreadContext context, byte[] name, org.jcodings.Encoding encoding) static booleanencSetDefaultEncoding(ThreadContext context, org.jcodings.Encoding[] def_p, IRubyObject encoding, String name) static voidencStrBufCat(Ruby runtime, RubyString str, byte[] ptrBytes) static voidencStrBufCat(Ruby runtime, RubyString str, byte[] ptrBytes, int ptr, int len, org.jcodings.Encoding enc) static voidencStrBufCat(Ruby runtime, RubyString str, byte[] ptrBytes, org.jcodings.Encoding enc) static voidencStrBufCat(Ruby runtime, RubyString str, CharSequence cseq) static voidencStrBufCat(Ruby runtime, RubyString str, ByteList ptr) static voidencStrBufCat(Ruby runtime, RubyString str, ByteList ptr, org.jcodings.Encoding enc) static RubyStringencUintChr(ThreadContext context, int code, org.jcodings.Encoding enc) static voidextractBinmode(Ruby runtime, IRubyObject optionsArg, int[] fmode_p) static voidextractModeEncoding(ThreadContext context, IOEncodable ioEncodable, Object vmodeAndVperm_p, IRubyObject options, int[] oflags_p, int[] fmode_p) static org.jcodings.EncodinggetActualEncoding(org.jcodings.Encoding enc, byte[] bytes, int p, int end) static org.jcodings.EncodinggetActualEncoding(org.jcodings.Encoding enc, ByteList byteList) static org.jcodings.EncodinggetEncoding(ByteList str) static org.jcodings.Encodingprivate static IRubyObjecthashARef(Ruby runtime, IRubyObject hash, String symbol) static IRubyObjectioEncStr(Ruby runtime, IRubyObject str, OpenFile fptr) static voidioExtIntToEncs(ThreadContext context, IOEncodable encodable, org.jcodings.Encoding external, org.jcodings.Encoding internal, int fmode) static booleanioExtractEncodingOption(ThreadContext context, IOEncodable ioEncodable, IRubyObject options, int[] fmode_p) static voidioSetEncodingByBOM(ThreadContext context, RubyIO io) static org.jcodings.EncodingioStripBOM(RubyIO io) Deprecated.static org.jcodings.EncodingioStripBOM(ThreadContext context, RubyIO io) static RaiseExceptionmakeEconvException(Ruby runtime, org.jcodings.transcode.EConv ec) private static RaiseExceptionmakeEConvExceptionSetEncs(RaiseException exc, Ruby runtime, org.jcodings.transcode.EConv ec) static final intMODE_BTMODE(int fmode, int a, int b, int c) (package private) static voidmoreOutputBuffer(ByteList destination, EncodingUtils.ResizeFunction resizeDestination, int maxOutput, org.jcodings.Ptr outStart, org.jcodings.Ptr outPos, org.jcodings.Ptr outStop) static RubyStringnewExternalStringWithEncoding(Ruby runtime, String string, org.jcodings.Encoding encoding) static RubyStringnewExternalStringWithEncoding(Ruby runtime, ByteList bytelist, org.jcodings.Encoding encoding) protected static booleannoDecorators(int ecflags) static IRubyObjectobjEncoding(ThreadContext context, IRubyObject obj) static IRubyObject[]openArgsToArgs(Ruby runtime, IRubyObject firstElement, RubyHash options) static voidparseModeEncoding(ThreadContext context, IOEncodable ioEncodable, String option, int[] fmode_p) static ByteListrbByteEncode(ThreadContext context, byte[] bytes, int start, int length, org.jcodings.Encoding encoding, int cr, org.jcodings.Encoding to, int ecflags, IRubyObject ecopt) static voidrbEncSetDefaultExternal(ThreadContext context, IRubyObject encoding) static voidrbEncSetDefaultInternal(ThreadContext context, IRubyObject encoding) static voidrbStrBufCat(Ruby runtime, RubyString str, ByteList ptr) static voidrbStrBufCat(Ruby runtime, ByteListHolder str, byte[] ptrBytes, int ptr, int len) static voidrbStrBufCat(Ruby runtime, ByteList str, byte[] ptrBytes, int ptr, int len) static intrbStrBufCatEscapedChar(RubyString result, long c, boolean unicode_p) static IRubyObjectrbStrEncode(ThreadContext context, IRubyObject str, IRubyObject to, int ecflags, IRubyObject ecopt) static RubyStringrbStrEscape(Ruby runtime, RubyString str) static org.jcodings.EncodingrbToEncoding(ThreadContext context, IRubyObject enc) static intSET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(org.jcodings.Encoding enc2, int ecflags) static RubyStringsetStrBuf(Ruby runtime, IRubyObject obj, int len) static org.jcodings.Encodingstatic voidstrBufCat(Ruby runtime, RubyString str, ByteList ptr) static voidstrBufCat(Ruby runtime, ByteListHolder str, byte[] ptrBytes, int ptr, int len) static voidstatic IRubyObjectstrCompatAndValid(ThreadContext context, IRubyObject _str, org.jcodings.Encoding enc) static RubyStringstrConvEnc(ThreadContext context, RubyString value, org.jcodings.Encoding fromEncoding, org.jcodings.Encoding toEncoding) static ByteListstrConvEnc(ThreadContext context, ByteList value, org.jcodings.Encoding fromEncoding, org.jcodings.Encoding toEncoding) static RubyStringstrConvEncOpts(ThreadContext context, RubyString str, org.jcodings.Encoding fromEncoding, org.jcodings.Encoding toEncoding, int ecflags, IRubyObject ecopts) This will try and transcode the supplied ByteList to the supplied toEncoding.static ByteListstrConvEncOpts(ThreadContext context, ByteList str, org.jcodings.Encoding fromEncoding, org.jcodings.Encoding toEncoding, int ecflags, IRubyObject ecopts) static IRubyObjectstrEncode(ThreadContext context, IRubyObject str, IRubyObject... args) static IRubyObjectstrEncodeAssociate(ThreadContext context, IRubyObject str, org.jcodings.Encoding encidx) static org.jcodings.EncodingstrTranscode(ThreadContext context, IRubyObject[] args, IRubyObject[] self_p) static org.jcodings.EncodingstrTranscode0(ThreadContext context, int argc, IRubyObject[] args, IRubyObject[] self_p, int ecflags, IRubyObject ecopts) static org.jcodings.EncodingstrTranscodeEncArgs(ThreadContext context, IRubyObject str, IRubyObject arg1, IRubyObject arg2, byte[][] sname_p, org.jcodings.Encoding[] senc_p, byte[][] dname_p, org.jcodings.Encoding[] denc_p) static org.jcodings.EncodingtoEncoding(ThreadContext context, IRubyObject enc) static org.jcodings.EncodingtoEncodingIndex(ThreadContext context, IRubyObject enc) static <Data> booleantranscodeLoop(org.jcodings.transcode.EConv ec, EncodingUtils.TranscodeFallback<Data> fallbackFunc, ThreadContext context, Data fallbackData, byte[] inBytes, org.jcodings.Ptr inPos, byte[] outBytes, org.jcodings.Ptr outPos, int inStop, int outStop, ByteList destination, EncodingUtils.ResizeFunction resizeFunction) Perform the inner transcoding loop.static voidtranscodeLoop(ThreadContext context, byte[] inBytes, org.jcodings.Ptr inPos, byte[] outBytes, org.jcodings.Ptr outPos, int inStop, int _outStop, ByteList destination, EncodingUtils.ResizeFunction resizeFunction, byte[] sname, byte[] dname, int ecflags, IRubyObject ecopts) Perform the inner transcoding loop.static ByteListtranscodeString(String string, org.jcodings.Encoding toEncoding, int ecflags) A version of transcodeLoop for working without any Ruby runtime available.static voidvalidateEncodingBinmode(ThreadContext context, int[] fmode_p, int ecflags, IOEncodable ioEncodable) static IRubyObjectstatic voidvmode(Object vmodeVperm, IRubyObject vmode) static ObjectvmodeVperm(IRubyObject vmode, IRubyObject vperm) static IRubyObjectstatic voidvperm(Object vmodeVperm, IRubyObject vperm)
-
Field Details
-
ECONV_DEFAULT_NEWLINE_DECORATOR
public static final int ECONV_DEFAULT_NEWLINE_DECORATOR -
DEFAULT_TEXTMODE
public static final int DEFAULT_TEXTMODE -
TEXTMODE_NEWLINE_DECORATOR_ON_WRITE
public static final int TEXTMODE_NEWLINE_DECORATOR_ON_WRITE -
NULL_BYTE_ARRAY
private static final byte[] NULL_BYTE_ARRAY -
VMODE
static final int VMODE- See Also:
-
PERM
static final int PERM- See Also:
-
strTranscodingResize
-
HASH_FALLBACK
-
PROC_FALLBACK
-
METHOD_FALLBACK
-
AREF_FALLBACK
-
UTF16Dummy
private static final org.jcodings.Encoding UTF16Dummy -
UTF32Dummy
private static final org.jcodings.Encoding UTF32Dummy
-
-
Constructor Details
-
EncodingUtils
public EncodingUtils()
-
-
Method Details
-
rbToEncoding
-
toEncoding
-
openArgsToArgs
public static IRubyObject[] openArgsToArgs(Ruby runtime, IRubyObject firstElement, RubyHash options) -
extractBinmode
-
hashARef
-
ascii8bitEncoding
-
vmodeVperm
-
vmode
-
vmode
-
vperm
-
vperm
-
MODE_BTMODE
public static final int MODE_BTMODE(int fmode, int a, int b, int c) -
SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2
public static int SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(org.jcodings.Encoding enc2, int ecflags) -
extractModeEncoding
public static void extractModeEncoding(ThreadContext context, IOEncodable ioEncodable, Object vmodeAndVperm_p, IRubyObject options, int[] oflags_p, int[] fmode_p) -
ioExtractEncodingOption
public static boolean ioExtractEncodingOption(ThreadContext context, IOEncodable ioEncodable, IRubyObject options, int[] fmode_p) -
newExternalStringWithEncoding
public static RubyString newExternalStringWithEncoding(Ruby runtime, String string, org.jcodings.Encoding encoding) -
newExternalStringWithEncoding
public static RubyString newExternalStringWithEncoding(Ruby runtime, ByteList bytelist, org.jcodings.Encoding encoding) -
ioExtIntToEncs
public static void ioExtIntToEncs(ThreadContext context, IOEncodable encodable, org.jcodings.Encoding external, org.jcodings.Encoding internal, int fmode) -
parseModeEncoding
public static void parseModeEncoding(ThreadContext context, IOEncodable ioEncodable, String option, int[] fmode_p) -
econvStrConvert
public static ByteList econvStrConvert(ThreadContext context, org.jcodings.transcode.EConv ec, ByteList src, int flags) -
econvByteConvert
public static ByteList econvByteConvert(ThreadContext context, org.jcodings.transcode.EConv ec, byte[] bytes, int start, int length, int flags) -
econvSubstrAppend
public static ByteList econvSubstrAppend(ThreadContext context, org.jcodings.transcode.EConv ec, ByteList src, ByteList dst, int flags) -
econvAppend
public static ByteList econvAppend(ThreadContext context, org.jcodings.transcode.EConv ec, ByteList sByteList, ByteList dst, int flags) -
econvAppend
public static ByteList econvAppend(ThreadContext context, org.jcodings.transcode.EConv ec, byte[] bytes, int start, int length, ByteList dst, int flags) -
econvCheckError
-
econvPrepareOpts
-
econvPrepareOptions
public static int econvPrepareOptions(ThreadContext context, IRubyObject opthash, IRubyObject[] opts, int ecflags) -
econvOpts
-
econvOpenOpts
public static org.jcodings.transcode.EConv econvOpenOpts(ThreadContext context, byte[] sourceEncoding, byte[] destinationEncoding, int ecflags, IRubyObject opthash) -
econvOpenExc
public static RaiseException econvOpenExc(ThreadContext context, byte[] sourceEncoding, byte[] destinationEncoding, int ecflags) -
econvDescription
public static String econvDescription(ThreadContext context, byte[] sourceEncoding, byte[] destinationEncoding, int ecflags, String message) -
econvAsciicompatEncoding
public static org.jcodings.Encoding econvAsciicompatEncoding(org.jcodings.Encoding enc) -
encAsciicompat
public static boolean encAsciicompat(org.jcodings.Encoding enc) -
encAscget
public static int encAscget(byte[] pBytes, int p, int e, int[] len, org.jcodings.Encoding enc) -
encMbminlen
public static int encMbminlen(org.jcodings.Encoding encoding) -
encDummy
public static boolean encDummy(org.jcodings.Encoding enc) -
encGet
-
encodingEqual
public static boolean encodingEqual(byte[] enc1, byte[] enc2) -
encArg
public static org.jcodings.Encoding encArg(ThreadContext context, IRubyObject encval, byte[][] name_p, org.jcodings.Encoding[] enc_p) -
toEncodingIndex
-
encodedDup
public static IRubyObject encodedDup(ThreadContext context, IRubyObject newstr, IRubyObject str, org.jcodings.Encoding encindex) -
strEncodeAssociate
public static IRubyObject strEncodeAssociate(ThreadContext context, IRubyObject str, org.jcodings.Encoding encidx) -
encAssociateIndex
-
strEncode
-
rbStrEncode
public static IRubyObject rbStrEncode(ThreadContext context, IRubyObject str, IRubyObject to, int ecflags, IRubyObject ecopt) -
rbByteEncode
public static ByteList rbByteEncode(ThreadContext context, byte[] bytes, int start, int length, org.jcodings.Encoding encoding, int cr, org.jcodings.Encoding to, int ecflags, IRubyObject ecopt) -
noDecorators
protected static boolean noDecorators(int ecflags) -
strTranscode
public static org.jcodings.Encoding strTranscode(ThreadContext context, IRubyObject[] args, IRubyObject[] self_p) -
strTranscode0
public static org.jcodings.Encoding strTranscode0(ThreadContext context, int argc, IRubyObject[] args, IRubyObject[] self_p, int ecflags, IRubyObject ecopts) -
objEncoding
-
strTranscodeEncArgs
public static org.jcodings.Encoding strTranscodeEncArgs(ThreadContext context, IRubyObject str, IRubyObject arg1, IRubyObject arg2, byte[][] sname_p, org.jcodings.Encoding[] senc_p, byte[][] dname_p, org.jcodings.Encoding[] denc_p) -
encRegistered
public static boolean encRegistered(byte[] name) -
encCheckDuplication
-
encReplicate
public static org.jcodings.Encoding encReplicate(ThreadContext context, byte[] name, org.jcodings.Encoding encoding) -
defineDummyEncoding
-
DECORATOR_P
public static boolean DECORATOR_P(byte[] sname, byte[] dname) -
strConvEncOpts
public static ByteList strConvEncOpts(ThreadContext context, ByteList str, org.jcodings.Encoding fromEncoding, org.jcodings.Encoding toEncoding, int ecflags, IRubyObject ecopts) -
strConvEncOpts
public static RubyString strConvEncOpts(ThreadContext context, RubyString str, org.jcodings.Encoding fromEncoding, org.jcodings.Encoding toEncoding, int ecflags, IRubyObject ecopts) This will try and transcode the supplied ByteList to the supplied toEncoding. It will use forceEncoding as its encoding if it is supplied; otherwise it will use the encoding it has tucked away in the bytelist. This will return a new copy of a ByteList in the request encoding or die trying (ConverterNotFound). c: rb_str_conv_enc_opts -
strConvEnc
public static RubyString strConvEnc(ThreadContext context, RubyString value, org.jcodings.Encoding fromEncoding, org.jcodings.Encoding toEncoding) -
strConvEnc
public static ByteList strConvEnc(ThreadContext context, ByteList value, org.jcodings.Encoding fromEncoding, org.jcodings.Encoding toEncoding) -
setStrBuf
-
encodingNames
-
transcodeLoop
public static void transcodeLoop(ThreadContext context, byte[] inBytes, org.jcodings.Ptr inPos, byte[] outBytes, org.jcodings.Ptr outPos, int inStop, int _outStop, ByteList destination, EncodingUtils.ResizeFunction resizeFunction, byte[] sname, byte[] dname, int ecflags, IRubyObject ecopts) Perform the inner transcoding loop.- See Also:
-
This version will determine fallback function and encoding options from the given options object. MRI: transcode_loop Ruby-related bits
-
transcodeString
public static ByteList transcodeString(String string, org.jcodings.Encoding toEncoding, int ecflags) A version of transcodeLoop for working without any Ruby runtime available. MRI: transcode_loop with no fallback and java.lang.String input -
getUTF16ForPlatform
public static org.jcodings.Encoding getUTF16ForPlatform() -
transcodeLoop
public static <Data> boolean transcodeLoop(org.jcodings.transcode.EConv ec, EncodingUtils.TranscodeFallback<Data> fallbackFunc, ThreadContext context, Data fallbackData, byte[] inBytes, org.jcodings.Ptr inPos, byte[] outBytes, org.jcodings.Ptr outPos, int inStop, int outStop, ByteList destination, EncodingUtils.ResizeFunction resizeFunction) Perform the inner transcoding loop. The data in inBytes will be transcoded from the source encoding to the destination, eventually replacing the contents of the given ByteList. Along the way, invalid characters may be handled by calling the fallback function (if non-null) with the given state and data. If the destination needs to be resized, use the given function to do so. Upon completion, destination will contain the resulting transcoded bytes. MRI: transcode_loop generified with EConv and fallback function provided- Type Parameters:
Data- type of data for the fallback function- Parameters:
ec- the encoding converterfallbackFunc- the fallback function for non-transcodable characters, or null if nonecontext- runtime state to pass into the fallbackfallbackData- call state to pass into the fallbackinBytes- the incoming byte arrayinPos- the position from which to start in the incoming bytearrayoutBytes- the initial output byte arrayoutPos- the position from which to start in the initial output byte arrayinStop- the position at which to stop in the inputoutStop- the number of bytes at which to stop in the outputdestination- the ByteList to hold the eventual outputresizeFunction- a function to use to grow the destination- Returns:
-
makeEconvException
-
makeEConvExceptionSetEncs
private static RaiseException makeEConvExceptionSetEncs(RaiseException exc, Ruby runtime, org.jcodings.transcode.EConv ec) -
moreOutputBuffer
static void moreOutputBuffer(ByteList destination, EncodingUtils.ResizeFunction resizeDestination, int maxOutput, org.jcodings.Ptr outStart, org.jcodings.Ptr outPos, org.jcodings.Ptr outStop) -
ioSetEncodingByBOM
-
ioStripBOM
-
validateEncodingBinmode
public static void validateEncodingBinmode(ThreadContext context, int[] fmode_p, int ecflags, IOEncodable ioEncodable) -
rbEncSetDefaultExternal
-
rbEncSetDefaultInternal
-
encSetDefaultEncoding
public static boolean encSetDefaultEncoding(ThreadContext context, org.jcodings.Encoding[] def_p, IRubyObject encoding, String name) -
defaultExternalEncoding
-
rbStrBufCat
-
rbStrBufCat
-
rbStrBufCat
-
strBufCat
-
strBufCat
-
strBufCat
-
encStrBufCat
public static void encStrBufCat(Ruby runtime, RubyString str, ByteList ptr, org.jcodings.Encoding enc) -
encStrBufCat
-
encStrBufCat
-
encStrBufCat
public static void encStrBufCat(Ruby runtime, RubyString str, byte[] ptrBytes, org.jcodings.Encoding enc) -
encStrBufCat
public static void encStrBufCat(Ruby runtime, RubyString str, byte[] ptrBytes, int ptr, int len, org.jcodings.Encoding enc) -
encStrBufCat
-
encCrStrBufCat
public static int encCrStrBufCat(Ruby runtime, CodeRangeable str, ByteList ptr, org.jcodings.Encoding ptrEnc, int ptr_cr) -
encCrStrBufCat
public static int encCrStrBufCat(Ruby runtime, CodeRangeable str, byte[] ptrBytes, int ptr, int len, org.jcodings.Encoding ptrEnc, int ptr_cr) -
econvArgs
public static void econvArgs(ThreadContext context, IRubyObject[] args, byte[][] encNames, org.jcodings.Encoding[] encs, int[] ecflags_p, IRubyObject[] ecopts_p) -
econvInitByConvpath
public static org.jcodings.transcode.EConv econvInitByConvpath(ThreadContext context, IRubyObject convpath, byte[][] encNames, org.jcodings.Encoding[] encs) -
decorateConvpath
-
ioEncStr
-
encUintChr
-
encMbcput
public static int encMbcput(int c, byte[] buf, int p, org.jcodings.Encoding enc) -
encMbcput
public static int encMbcput(ThreadContext context, int c, byte[] buf, int p, org.jcodings.Encoding enc) -
encCodepointLength
public static int encCodepointLength(byte[] pBytes, int p, int e, int[] len_p, org.jcodings.Encoding enc) -
encCodepointLength
public static int encCodepointLength(Ruby runtime, byte[] pBytes, int p, int e, int[] len_p, org.jcodings.Encoding enc) -
strCompatAndValid
public static IRubyObject strCompatAndValid(ThreadContext context, IRubyObject _str, org.jcodings.Encoding enc) -
getEncoding
-
getActualEncoding
-
getActualEncoding
public static org.jcodings.Encoding getActualEncoding(org.jcodings.Encoding enc, byte[] bytes, int p, int end) -
STR_ENC_GET
-
rbStrEscape
-
rbStrBufCatEscapedChar
-
charsetForEncoding
Get an appropriate Java Charset for the given Encoding. This works around a bug in jcodings where it would return null as the charset for encodings that should have a match, like Windows-1252. This method is equivalent to enc.getCharset in jcodings 1.0.25 and higher. See https://github.com/jruby/jruby/issues/4716 for more information.- Parameters:
enc- the encoding for which to get a matching charset- Returns:
- the matching charset
-
encCodelen
-
ioStripBOM
Deprecated.
-