Package org.jruby.util.io
Class EncodingUtils
java.lang.Object
org.jruby.util.io.EncodingUtils
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfaceFallback function to provide replacements for characters that fail to transcode.static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final EncodingUtils.ResizeFunctionstatic 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 convpathArg, 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) Deprecated.static intencCodepointLength(ThreadContext context, 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 RubyStringencodedDup(ThreadContext context, RubyString str, org.jcodings.Encoding encindex, RubyString newstr) static IRubyObjectencodedDup(ThreadContext context, IRubyObject newstr, IRubyObject str, org.jcodings.Encoding encindex) Deprecated.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) Deprecated.static voidextractBinmode(ThreadContext context, IRubyObject optionsArg, int[] fmode_p) static voidextractModeEncoding(ThreadContext context, IOEncodable ioEncodable, Object vmodeAndVperm_p, IRubyObject options, int[] oflags_p, int[] fmode_p) Deprecated.static voidextractModeEncoding(ThreadContext context, IOEncodable ioEncodable, API.ModeAndPermission 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.Encodingstatic RubyStringioEncStr(Ruby runtime, RubyString str, OpenFile fptr) 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 org.jcodings.EncodingioSetEncodingByBOM(ThreadContext context, RubyIO io) static org.jcodings.EncodingioStripBOM(RubyIO io) Deprecated.static org.jcodings.EncodingioStripBOM(ThreadContext context, RubyIO io) static booleanisPrint(int c) static RaiseExceptionmakeEconvException(Ruby runtime, org.jcodings.transcode.EConv ec) Deprecated.static RaiseExceptionmakeEconvException(ThreadContext context, org.jcodings.transcode.EConv ec) static final intMODE_BTMODE(int fmode, int a, int b, int c) 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) Deprecated.static IRubyObject[]openArgsToArgs(ThreadContext context, IRubyObject firstElement, RubyHash options) Deprecated.static voidparseModeEncoding(ThreadContext context, IOEncodable ioEncodable, String option, int[] fmode_p) static org.jcodings.EncodingrbAscii8bitAppendableEncodingIndex(ThreadContext context, org.jcodings.Encoding enc, int code) static ByteListrbByteEncode(ThreadContext context, byte[] bytes, int start, int length, org.jcodings.Encoding encoding, int cr, org.jcodings.Encoding to, int ecflags, IRubyObject ecopt) A version of rbStrEncode that works directly with bytes.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) Deprecated.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, RubyString str) static IRubyObjectstrEncode(ThreadContext context, RubyString str, IRubyObject toEncoding) static IRubyObjectstrEncode(ThreadContext context, RubyString str, IRubyObject toEncoding, IRubyObject forcedEncoding) static IRubyObjectstrEncode(ThreadContext context, RubyString str, IRubyObject toEncoding, IRubyObject forcedEncoding, IRubyObject opts) static IRubyObjectstrEncode(ThreadContext context, IRubyObject str, IRubyObject... args) Deprecated.static RubyStringstrEncodeAssociate(RubyString str, org.jcodings.Encoding encidx) static IRubyObjectstrEncodeAssociate(ThreadContext context, IRubyObject str, org.jcodings.Encoding encidx) Deprecated.static IRubyObjectstrTranscode(ThreadContext context, RubyString str, EncodingUtils.TranscodeResult result) static IRubyObjectstrTranscode(ThreadContext context, IRubyObject[] args, RubyString str, EncodingUtils.TranscodeResult result) Deprecated.static org.jcodings.EncodingstrTranscode(ThreadContext context, IRubyObject[] args, IRubyObject[] self_p) Deprecated.static IRubyObjectstrTranscode(ThreadContext context, IRubyObject toEncoding, RubyString str, EncodingUtils.TranscodeResult result) static IRubyObjectstrTranscode(ThreadContext context, IRubyObject toEncoding, IRubyObject forcedEncoding, RubyString str, EncodingUtils.TranscodeResult result) static IRubyObjectstrTranscode(ThreadContext context, IRubyObject toEncoding, IRubyObject forcedEncoding, IRubyObject opts, RubyString str, EncodingUtils.TranscodeResult result) static org.jcodings.EncodingstrTranscode0(ThreadContext context, int argc, IRubyObject[] args, IRubyObject[] self_p, int ecflags, IRubyObject ecopts) Deprecated.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 IRubyObjectDeprecated.static voidvmode(Object vmodeVperm, IRubyObject vmode) Deprecated.static IRubyObjectvmode(API.ModeAndPermission vmodeVperm) static voidvmode(API.ModeAndPermission vmodeVperm, IRubyObject vmode) static ObjectvmodeVperm(IRubyObject vmode, IRubyObject vperm) Deprecated.static IRubyObjectDeprecated.static voidvperm(Object vmodeVperm, IRubyObject vperm) Deprecated.static IRubyObjectvperm(API.ModeAndPermission vmodeVperm) static voidvperm(API.ModeAndPermission 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 -
strTranscodingResize
-
-
Constructor Details
-
EncodingUtils
public EncodingUtils()
-
-
Method Details
-
rbToEncoding
-
toEncoding
-
openArgsToArgs
@Deprecated public static IRubyObject[] openArgsToArgs(Ruby runtime, IRubyObject firstElement, RubyHash options) Deprecated. -
openArgsToArgs
@Deprecated public static IRubyObject[] openArgsToArgs(ThreadContext context, IRubyObject firstElement, RubyHash options) Deprecated. -
extractBinmode
Deprecated. -
extractBinmode
-
ascii8bitEncoding
-
vmodeVperm
Deprecated. -
vmode
Deprecated. -
vmode
Deprecated. -
vperm
Deprecated. -
vperm
Deprecated. -
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
@Deprecated public static void extractModeEncoding(ThreadContext context, IOEncodable ioEncodable, Object vmodeAndVperm_p, IRubyObject options, int[] oflags_p, int[] fmode_p) Deprecated. -
extractModeEncoding
public static void extractModeEncoding(ThreadContext context, IOEncodable ioEncodable, API.ModeAndPermission 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 RubyString encodedDup(ThreadContext context, RubyString str, org.jcodings.Encoding encindex, RubyString newstr) -
strEncodeAssociate
-
encAssociateIndex
-
strEncode
-
strEncode
-
strEncode
public static IRubyObject strEncode(ThreadContext context, RubyString str, IRubyObject toEncoding, IRubyObject forcedEncoding) -
strEncode
public static IRubyObject strEncode(ThreadContext context, RubyString str, IRubyObject toEncoding, IRubyObject forcedEncoding, IRubyObject opts) -
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) A version of rbStrEncode that works directly with bytes. MRI: rb_str_encode but consuming only a byte array range and producing a ByteList.- Parameters:
context-bytes-start-length-encoding-cr-to-ecflags-ecopt-- Returns:
-
noDecorators
protected static boolean noDecorators(int ecflags) -
strTranscode
public static IRubyObject strTranscode(ThreadContext context, RubyString str, EncodingUtils.TranscodeResult result) -
strTranscode
public static IRubyObject strTranscode(ThreadContext context, IRubyObject toEncoding, RubyString str, EncodingUtils.TranscodeResult result) -
strTranscode
public static IRubyObject strTranscode(ThreadContext context, IRubyObject toEncoding, IRubyObject forcedEncoding, RubyString str, EncodingUtils.TranscodeResult result) -
strTranscode
public static IRubyObject strTranscode(ThreadContext context, IRubyObject toEncoding, IRubyObject forcedEncoding, IRubyObject opts, RubyString str, EncodingUtils.TranscodeResult result) -
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. 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
@Deprecated(since="10.0") public static RaiseException makeEconvException(Ruby runtime, org.jcodings.transcode.EConv ec) Deprecated. -
makeEconvException
public static RaiseException makeEconvException(ThreadContext context, org.jcodings.transcode.EConv ec) -
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 convpathArg, byte[][] encNames, org.jcodings.Encoding[] encs) -
decorateConvpath
-
ioEncStr
-
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
@Deprecated public static int encCodepointLength(Ruby runtime, byte[] pBytes, int p, int e, int[] len_p, org.jcodings.Encoding enc) Deprecated. -
encCodepointLength
public static int encCodepointLength(ThreadContext context, 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
Deprecated. -
isPrint
public static boolean isPrint(int c) -
rbStrBufCatEscapedChar
-
charsetForEncoding
public static Charset charsetForEncoding(org.jcodings.Encoding enc) throws UnsupportedCharsetException 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
- Throws:
UnsupportedCharsetException
-
encCodelen
-
rbAscii8bitAppendableEncodingIndex
public static org.jcodings.Encoding rbAscii8bitAppendableEncodingIndex(ThreadContext context, org.jcodings.Encoding enc, int code) -
ioStripBOM
Deprecated. -
strTranscode0
@Deprecated public static org.jcodings.Encoding strTranscode0(ThreadContext context, int argc, IRubyObject[] args, IRubyObject[] self_p, int ecflags, IRubyObject ecopts) Deprecated. -
strTranscode
@Deprecated public static org.jcodings.Encoding strTranscode(ThreadContext context, IRubyObject[] args, IRubyObject[] self_p) Deprecated. -
strEncode
@Deprecated public static IRubyObject strEncode(ThreadContext context, IRubyObject str, IRubyObject... args) Deprecated. -
encodedDup
@Deprecated public static IRubyObject encodedDup(ThreadContext context, IRubyObject newstr, IRubyObject str, org.jcodings.Encoding encindex) Deprecated. -
strEncodeAssociate
@Deprecated public static IRubyObject strEncodeAssociate(ThreadContext context, IRubyObject str, org.jcodings.Encoding encidx) Deprecated. -
strTranscode
@Deprecated public static IRubyObject strTranscode(ThreadContext context, IRubyObject[] args, RubyString str, EncodingUtils.TranscodeResult result) Deprecated.
-