Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2014 Red Hat, Inc.
*
* Red Hat licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.vertx.groovy.core.buffer;
import groovy.transform.CompileStatic
import io.vertx.lang.groovy.InternalHelper
import io.vertx.core.json.JsonObject
import io.vertx.core.json.JsonArray
import io.vertx.core.shareddata.impl.ClusterSerializable
import io.vertx.core.json.JsonObject
/**
* Most data is shuffled around inside Vert.x using buffers.
*
* A buffer is a sequence of zero or more bytes that can read from or written to and which expands automatically as
* necessary to accommodate any bytes written to it. You can perhaps think of a buffer as smart byte array.
*
* Please consult the documentation for more information on buffers.
*/
@CompileStatic
public class Buffer {
private final def io.vertx.core.buffer.Buffer delegate;
public Buffer(Object delegate) {
this.delegate = (io.vertx.core.buffer.Buffer) delegate;
}
public Object getDelegate() {
return delegate;
}
/**
* Create a new, empty buffer.
* @return the buffer
*/
public static Buffer buffer() {
def ret= InternalHelper.safeCreate(io.vertx.core.buffer.Buffer.buffer(), io.vertx.groovy.core.buffer.Buffer.class);
return ret;
}
/**
* Create a new buffer given the initial size hint.
*
* If you know the buffer will require a certain size, providing the hint can prevent unnecessary re-allocations
* as the buffer is written to and resized.
* @param initialSizeHint the hint, in bytes
* @return the buffer
*/
public static Buffer buffer(int initialSizeHint) {
def ret= InternalHelper.safeCreate(io.vertx.core.buffer.Buffer.buffer(initialSizeHint), io.vertx.groovy.core.buffer.Buffer.class);
return ret;
}
/**
* Create a new buffer from a string. The string will be UTF-8 encoded into the buffer.
* @param string the string
* @return the buffer
*/
public static Buffer buffer(String string) {
def ret= InternalHelper.safeCreate(io.vertx.core.buffer.Buffer.buffer(string), io.vertx.groovy.core.buffer.Buffer.class);
return ret;
}
/**
* Create a new buffer from a string and using the specified encoding.
* The string will be encoded into the buffer using the specified encoding.
* @param string the string
* @param enc
* @return the buffer
*/
public static Buffer buffer(String string, String enc) {
def ret= InternalHelper.safeCreate(io.vertx.core.buffer.Buffer.buffer(string, enc), io.vertx.groovy.core.buffer.Buffer.class);
return ret;
}
/**
* Returns a String representation of the Buffer with the UTF-8encoding
* @return
*/
public String toString() {
def ret = this.delegate.toString();
return ret;
}
/**
* Returns a String representation of the Buffer with the encoding specified by enc
* @param enc
* @return
*/
public String toString(String enc) {
def ret = this.delegate.toString(enc);
return ret;
}
/**
* Returns a Json object representation of the Buffer
* @return
*/
public Map toJsonObject() {
def ret = (Map)InternalHelper.wrapObject(this.delegate.toJsonObject());
return ret;
}
/**
* Returns a Json array representation of the Buffer
* @return
*/
public List