/** * @param realSize the realSize to set */ public void setRealSize(int realSize) { realSize(realSize); }
/** * @return the realSize */ public int getRealSize() { return realSize(); }
/** * @return the realSize */ public int getRealSize() { return realSize(); }
private static void validateDataSize(Ruby runtime, ByteList data, int size) { int realSize = data.realSize(); if (realSize != size) { throw runtime.newTypeError("size differ. expected as sizeof(int)=" + size + " but " + realSize); } }
private static void validateDataSize(Ruby runtime, ByteList data, int size) { int realSize = data.realSize(); if (realSize != size) { throw runtime.newTypeError("size differ. expected as sizeof(int)=" + size + " but " + realSize); } }
@Deprecated public RubyArray split19(IRubyObject spat, ThreadContext context, boolean useBackref) { return splitCommon(context, spat, false, value.realSize(), 0, useBackref); }
public static String byteListAsString(ByteList bytes) { try { Charset charset = bytes.getEncoding().getCharset(); if (charset != null) return new String(bytes.unsafeBytes(), bytes.begin(), bytes.realSize(), charset); } catch (UnsupportedCharsetException e) {} return new String(bytes.unsafeBytes(), bytes.begin(), bytes.realSize()); }
public static String byteListAsString(ByteList bytes) { try { Charset charset = bytes.getEncoding().getCharset(); if (charset != null) return new String(bytes.unsafeBytes(), bytes.begin(), bytes.realSize(), charset); } catch (UnsupportedCharsetException e) {} return new String(bytes.unsafeBytes(), bytes.begin(), bytes.realSize()); }
@Override public Channel getRemainingAsChannel() { ByteArrayInputStream bais = new ByteArrayInputStream(completeSource.unsafeBytes(), completeSource.begin(), completeSource.realSize()); bais.skip(offset); return ChannelHelper.readableChannel(bais); }
public boolean endsWithAsciiChar(char c) { ByteList value = this.value; int size; return value.getEncoding().isAsciiCompatible() && (size = value.realSize()) > 0 && value.get(size - 1) == c; }
@Override public Channel getRemainingAsChannel() { ByteArrayInputStream bais = new ByteArrayInputStream(completeSource.unsafeBytes(), completeSource.begin(), completeSource.realSize()); bais.skip(offset); return ChannelHelper.readableChannel(bais); }
public boolean endsWithAsciiChar(char c) { ByteList value = this.value; int size; return value.getEncoding().isAsciiCompatible() && (size = value.realSize()) > 0 && value.get(size - 1) == c; }
public static int[] unpackLinger(ByteList data) { ByteList result = new ByteList(8); ByteBuffer buf = ByteBuffer.wrap(data.unsafeBytes(), data.begin(), data.realSize()); int vonoff = Pack.unpackInt_i(buf); int vsecs = Pack.unpackInt_i(buf); return new int[] {vonoff, vsecs}; }
private int strOffset(int nth, boolean singlebyte) { int p = value.begin(); int size = value.realSize(); int e = p + size; int pp = nth(value.getEncoding(), value.unsafeBytes(), p, e, nth, singlebyte); if (pp == -1) return size; return pp - p; }
private int strOffset(int nth, boolean singlebyte) { int p = value.begin(); int size = value.realSize(); int e = p + size; int pp = nth(value.getEncoding(), value.unsafeBytes(), p, e, nth, singlebyte); if (pp == -1) return size; return pp - p; }
private void ungetbyteCommon(RubyString ungetBytes) { ByteList ungetByteList = ungetBytes.getByteList(); ungetbyteCommon(ungetByteList.unsafeBytes(), ungetByteList.begin(), ungetByteList.realSize()); }
private Variable argumentResult(RubySymbol name) { boolean isUnderscore = name.getBytes().realSize() == 1 && name.getBytes().charAt(0) == '_'; if (isUnderscore && underscoreVariableSeen) { return createTemporaryVariable(); } else { if (isUnderscore) underscoreVariableSeen = true; return getNewLocalVariable(name, 0); } }
private Variable argumentResult(RubySymbol name) { boolean isUnderscore = name.getBytes().realSize() == 1 && name.getBytes().charAt(0) == '_'; if (isUnderscore && underscoreVariableSeen) { return createTemporaryVariable(); } else { if (isUnderscore) underscoreVariableSeen = true; return getNewLocalVariable(name, 0); } }
@JRubyMethod(name = "delete_prefix!") public IRubyObject delete_prefix_bang(ThreadContext context, IRubyObject prefix) { modifyAndKeepCodeRange(); int prefixlen = deletedPrefixLength(prefix); if (prefixlen <= 0) return context.nil; // MRI: rb_str_drop_bytes, in a nutshell modify(); value.view(prefixlen, value.realSize() - prefixlen); clearCodeRange(); return this; }
public ByteList shadowing_lvar(ByteList nameBytes) { if (nameBytes.realSize() == 1 && nameBytes.charAt(0) == '_') return nameBytes; RubySymbol name = symbolID(nameBytes); String id = name.idString(); StaticScope current = getCurrentScope(); if (current.exists(id) >= 0) yyerror("duplicated argument name"); if (current.isBlockScope() && warnings.isVerbose() && current.isDefined(id) >= 0 && Options.PARSER_WARN_LOCAL_SHADOWING.load()) { Ruby runtime = getConfiguration().getRuntime(); warnings.warning(ID.STATEMENT_NOT_REACHED, lexer.getFile(), lexer.getPosition().getLine(), str(runtime, "shadowing outer local variable - ", ids(runtime, name))); } return nameBytes; }