Package org.jruby

Examples of org.jruby.RubyString.cat()


            } else {
                RubyString stringBuffer = RubyString.newEmptyString(getRuntime());
                byte readByte = byteBuffer.get(0);
                // 10 is newline
                while (readByte != 10) {
                    stringBuffer.cat(readByte);
                    byteBuffer.clear();
                    bytesRead = inputChannel.read(byteBuffer);
                    if (bytesRead == -1) {
                        break; // EOF
                    }
View Full Code Here


                        break; // EOF
                    }
                    readByte = byteBuffer.get(0);
                }
                if (readByte == 10) {
                     stringBuffer.cat(10);
                }
                return stringBuffer;
            }
        } catch (IOException e) {
            throw getRuntime().newIOErrorFromException(e);
View Full Code Here

        }

        byte[] bytes = byteBufferToBytes(byteBuffer, bytesRead);
        if (stringBuffer != null) {
            stringBuffer.clear();
            stringBuffer.cat(bytes);
        } else {
            stringBuffer = getRuntime().newString(new ByteList(bytes));
        }
        while (bytesRead != -1 && totalBytesRead < bytesToRead) {
            byteBuffer.clear();
View Full Code Here

            }
            bytesRead = inputChannel.read(byteBuffer);
            totalBytesRead += bytesRead;
            if (bytesRead > 0) {
                bytes = byteBufferToBytes(byteBuffer, bytesRead);
                stringBuffer.cat(bytes);
            }
        }
        return stringBuffer;
    }
View Full Code Here

        try {
            byte[] bytes = readUntil(Integer.MAX_VALUE, count);
            if (bytes != null) {
                if (string != null) {
                    string.clear();
                    string.cat(bytes);
                    return string;
                }
                return getRuntime().newString(new ByteList(bytes));
            } else {
                if (count > 0) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.