Top Inners Fields Constructors Methods
org.jruby.util

public Class Sprintf

extends Object
Class Inheritance
Imports
java.math.BigInteger, java.text.DecimalFormatSymbols, .NumberFormat, java.util.HashMap, .Locale, .Map, org.jcodings.Encoding, org.jcodings.exception.EncodingException, org.jcodings.specific.UTF8Encoding, org.jruby.*, org.jruby.api.Warn, org.jruby.common.IRubyWarnings.ID, org.jruby.runtime.ThreadContext, org.jruby.runtime.builtin.IRubyObject, org.jruby.util.io.EncodingUtils

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final long
private static final BigInteger
private static final BigInteger
private static final BigInteger
private static final BigInteger
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final byte[]
private static final byte[]
private static final byte[]
private static final ThreadLocal<Map<Locale, DecimalFormatSymbols>>
private static final ThreadLocal<Map<Locale, NumberFormat>>
private static final long
private static final byte[]
private static final byte[]
private static final byte[]
private static final byte[]
private static final byte[]
private static final byte[]
private static final byte[]
private static final long

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static void
checkOffset(Sprintf.Args args, int offset, int length, String message)

private static int
extendWidth(Sprintf.Args args, int oldWidth, byte newChar, final String errMessage)

private static int
generateBinaryFloat(ThreadContext context, int flags, int precision, byte fchar, ByteList bytes, IRubyObject arg)

private static int[]
GETASTER(ThreadContext context, final Sprintf.Args args, final byte[] format, int offset, final int length, final boolean width)

private static byte[]
getBignumBytes(final BigInteger val, int base, boolean sign, boolean upper)

public static DecimalFormatSymbols
private static byte
getDigit(int position, byte[] bytes)

private static long
private static byte[]
getFixnumBytes(final long val, int base, boolean sign, boolean upper)

private static byte[]
public static NumberFormat
private static int
getNumberOfDigits(byte[] bytes)

private static byte[]
getUnsignedNegativeBytes(final long val)

private static byte[]
private static boolean
isDigit(byte aChar)

private static boolean
private static boolean
private static boolean
isPrintable(byte aChar)

private static void
printSpecialValue(ByteList buf, int flags, int width, boolean isnan, boolean negative)

private static void
private static int
round(byte[] bytes, final int nDigits, int roundPos, boolean roundDown)

private static void
private static void
private static void
rubySprintfToBuffer(final ByteList buf, final CharSequence charFormat, final Sprintf.Args args, final boolean usePrefixForZero)

private static int
skipSignBits(byte[] bytes, int base)

public static boolean
sprintf(ByteList to, Locale locale, CharSequence format, IRubyObject args)

public static boolean
public static ByteList
sprintf(Encoding encoding, CharSequence format, IRubyObject args)

public static boolean
sprintf(Ruby runtime, ByteList to, CharSequence format, int arg)

public static boolean
sprintf(Ruby runtime, ByteList to, CharSequence format, long arg)

public static boolean
public static boolean
private static byte[]
stringToBytes(CharSequence s, boolean upper)

private static byte[]
private static void
writeExp(ByteList buf, int exponent, byte expChar)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BIASED_EXP_MASKback to summary
private static final long BIASED_EXP_MASK
BIG_32back to summary
private static final BigInteger BIG_32
BIG_64back to summary
private static final BigInteger BIG_64
BIG_MINUS_32back to summary
private static final BigInteger BIG_MINUS_32
BIG_MINUS_64back to summary
private static final BigInteger BIG_MINUS_64
ERR_ILLEGAL_FORMAT_CHARback to summary
private static final String ERR_ILLEGAL_FORMAT_CHAR
ERR_INCOMPLETE_FORMAT_SPECback to summary
private static final String ERR_INCOMPLETE_FORMAT_SPEC
ERR_MALFORMED_DOT_NUMback to summary
private static final String ERR_MALFORMED_DOT_NUM
ERR_MALFORMED_FORMATback to summary
private static final String ERR_MALFORMED_FORMAT
ERR_MALFORMED_NAMEback to summary
private static final String ERR_MALFORMED_NAME
ERR_MALFORMED_NUMback to summary
private static final String ERR_MALFORMED_NUM
ERR_MALFORMED_STAR_NUMback to summary
private static final String ERR_MALFORMED_STAR_NUM
FLAG_MINUSback to summary
private static final int FLAG_MINUS
FLAG_NONEback to summary
private static final int FLAG_NONE
FLAG_PLUSback to summary
private static final int FLAG_PLUS
FLAG_PRECISIONback to summary
private static final int FLAG_PRECISION
FLAG_SHARPback to summary
private static final int FLAG_SHARP
FLAG_SPACEback to summary
private static final int FLAG_SPACE
FLAG_WIDTHback to summary
private static final int FLAG_WIDTH
FLAG_ZEROback to summary
private static final int FLAG_ZERO
HEX_DIGITSback to summary
private static final byte[] HEX_DIGITS
HEX_DIGITS_UPPER_CASEback to summary
private static final byte[] HEX_DIGITS_UPPER_CASE
INFINITY_VALUEback to summary
private static final byte[] INFINITY_VALUE
LOCALE_DECIMAL_FORMATSback to summary
private static final ThreadLocal<Map<Locale, DecimalFormatSymbols>> LOCALE_DECIMAL_FORMATS
LOCALE_NUMBER_FORMATSback to summary
private static final ThreadLocal<Map<Locale, NumberFormat>> LOCALE_NUMBER_FORMATS
MANTISSA_MASKback to summary
private static final long MANTISSA_MASK
NAN_VALUEback to summary
private static final byte[] NAN_VALUE
PREFIX_BINARY_LCback to summary
private static final byte[] PREFIX_BINARY_LC
PREFIX_BINARY_UCback to summary
private static final byte[] PREFIX_BINARY_UC
PREFIX_HEX_LCback to summary
private static final byte[] PREFIX_HEX_LC
PREFIX_HEX_UCback to summary
private static final byte[] PREFIX_HEX_UC
PREFIX_NEGATIVEback to summary
private static final byte[] PREFIX_NEGATIVE
PREFIX_OCTALback to summary
private static final byte[] PREFIX_OCTAL
SIGN_MASKback to summary
private static final long SIGN_MASK

Constructor Detail

Sprintfback to summary
private Sprintf()

Method Detail

checkOffsetback to summary
private static void checkOffset(Sprintf.Args args, int offset, int length, String message)
extendWidthback to summary
private static int extendWidth(Sprintf.Args args, int oldWidth, byte newChar, final String errMessage)
generateBinaryFloatback to summary
private static int generateBinaryFloat(ThreadContext context, int flags, int precision, byte fchar, ByteList bytes, IRubyObject arg)
GETASTERback to summary
private static int[] GETASTER(ThreadContext context, final Sprintf.Args args, final byte[] format, int offset, final int length, final boolean width)
getBignumBytesback to summary
private static byte[] getBignumBytes(final BigInteger val, int base, boolean sign, boolean upper)
getDecimalFormatback to summary
public static DecimalFormatSymbols getDecimalFormat(Locale locale)
getDigitback to summary
private static byte getDigit(int position, byte[] bytes)
getExponentback to summary
private static long getExponent(ThreadContext context, IRubyObject value)
getFixnumBytesback to summary
private static byte[] getFixnumBytes(final long val, int base, boolean sign, boolean upper)
getMantissaBytesback to summary
private static byte[] getMantissaBytes(ThreadContext context, IRubyObject value)
getNumberFormatback to summary
public static NumberFormat getNumberFormat(Locale locale)
getNumberOfDigitsback to summary
private static int getNumberOfDigits(byte[] bytes)
getUnsignedNegativeBytesback to summary
private static byte[] getUnsignedNegativeBytes(final long val)
getUnsignedNegativeBytesback to summary
private static byte[] getUnsignedNegativeBytes(final BigInteger val)
isDigitback to summary
private static boolean isDigit(byte aChar)
isFormatSpecifierback to summary
private static boolean isFormatSpecifier(byte b)
isPositiveback to summary
private static boolean isPositive(ThreadContext context, Object value)
isPrintableback to summary
private static boolean isPrintable(byte aChar)
printSpecialValueback to summary
private static void printSpecialValue(ByteList buf, int flags, int width, boolean isnan, boolean negative)
raiseArgumentErrorback to summary
private static void raiseArgumentError(Sprintf.Args args, String message)
roundback to summary
private static int round(byte[] bytes, final int nDigits, int roundPos, boolean roundDown)
rubySprintfback to summary
private static void rubySprintf(ByteList to, CharSequence charFormat, Sprintf.Args args)
rubySprintfToBufferback to summary
private static void rubySprintfToBuffer(ByteList buf, CharSequence charFormat, Sprintf.Args args)
rubySprintfToBufferback to summary
private static void rubySprintfToBuffer(final ByteList buf, final CharSequence charFormat, final Sprintf.Args args, final boolean usePrefixForZero)
skipSignBitsback to summary
private static int skipSignBits(byte[] bytes, int base)
sprintfback to summary
public static boolean sprintf(ByteList to, Locale locale, CharSequence format, IRubyObject args)
sprintfback to summary
public static boolean sprintf(ByteList to, CharSequence format, IRubyObject args)
sprintfback to summary
public static ByteList sprintf(Encoding encoding, CharSequence format, IRubyObject args)
sprintfback to summary
public static boolean sprintf(Ruby runtime, ByteList to, CharSequence format, int arg)
sprintfback to summary
public static boolean sprintf(Ruby runtime, ByteList to, CharSequence format, long arg)
sprintfback to summary
public static boolean sprintf(ByteList to, RubyString format, IRubyObject args)
sprintf1_9back to summary
public static boolean sprintf1_9(ByteList to, Locale locale, CharSequence format, IRubyObject args)
stringToBytesback to summary
private static byte[] stringToBytes(CharSequence s, boolean upper)
stringToBytesback to summary
private static byte[] stringToBytes(CharSequence s)
writeExpback to summary
private static void writeExp(ByteList buf, int exponent, byte expChar)
org.jruby.util back to summary

private final Class Sprintf.Args

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final int
private final Locale
private int
private IRubyObject
private int
private final RubyArray<T extends IRubyObject>
private final RubyHash
private final IRubyObject
private final Ruby

Constructor Summary

AccessConstructor and Description
pack-priv
Args(Locale locale, IRubyObject rubyObject)

pack-priv
Args(IRubyObject rubyObject)

pack-priv
Args(Ruby runtime, long value)

Method Summary

Modifier and TypeMethod and Description
private void
checkNameArg(ByteList name, char startDelim, char endDelim)

private void
private void
checkPositionArg(int nthArg)

private IRubyObject
pack-priv byte
private IRubyObject
getHashValue(ByteList name, char startDelim, char endDelim)

private IRubyObject
private IRubyObject
getNthArg(int index)

private IRubyObject
getPositionArg(int index)

pack-priv int
pack-priv IRubyObject
next(ByteList name)
Deprecated

pack-priv void
pack-priv void
pack-priv void
warn(IRubyWarnings.ID id, String message)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lengthback to summary
private final int length
localeback to summary
private final Locale locale
nextIndexback to summary
private int nextIndex
nextObjectback to summary
private IRubyObject nextObject
positionIndexback to summary
private int positionIndex
rubyArrayback to summary
private final RubyArray<T extends IRubyObject> rubyArray
rubyHashback to summary
private final RubyHash rubyHash
rubyObjectback to summary
private final IRubyObject rubyObject
runtimeback to summary
private final Ruby runtime

Constructor Detail

Argsback to summary
pack-priv Args(Locale locale, IRubyObject rubyObject)
Argsback to summary
pack-priv Args(IRubyObject rubyObject)
Argsback to summary
pack-priv Args(Ruby runtime, long value)

Method Detail

checkNameArgback to summary
private void checkNameArg(ByteList name, char startDelim, char endDelim)
checkNextArgback to summary
private void checkNextArg()
checkPositionArgback to summary
private void checkPositionArg(int nthArg)
getArgback to summary
private IRubyObject getArg()
getDecimalSeparatorback to summary
pack-priv byte getDecimalSeparator()
getHashValueback to summary
private IRubyObject getHashValue(ByteList name, char startDelim, char endDelim)
getNextArgback to summary
private IRubyObject getNextArg()
getNthArgback to summary
private IRubyObject getNthArg(int index)
getPositionArgback to summary
private IRubyObject getPositionArg(int index)
intValueback to summary
pack-priv int intValue(ThreadContext context, IRubyObject obj)
nextback to summary
pack-priv IRubyObject next(ByteList name)

Deprecated

Annotations
@Deprecated
raiseArgumentErrorback to summary
pack-priv void raiseArgumentError(String message)
raiseKeyErrorback to summary
pack-priv void raiseKeyError(String message, IRubyObject recv, IRubyObject key)
warnback to summary
pack-priv void warn(IRubyWarnings.ID id, String message)