Tabnine Logo
ByteArrayDataOutputStream.ensureCapacity
Code IndexAdd Tabnine to your IDE (free)

How to use
ensureCapacity
method
in
org.jgroups.util.ByteArrayDataOutputStream

Best Java code snippets using org.jgroups.util.ByteArrayDataOutputStream.ensureCapacity (Showing top 10 results out of 315)

origin: wildfly/wildfly

public void write(int b) {
  ensureCapacity(1);
  buf[pos++]=(byte)b;
}
origin: wildfly/wildfly

public void write(byte[] b, int off, int len) {
  if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) - b.length > 0))
    throw new IndexOutOfBoundsException(String.format("off=%d, len=%d, b.length=%d", off, len, b.length));
  ensureCapacity(len);
  System.arraycopy(b, off, buf, pos, len);
  pos+=len;
}
origin: wildfly/wildfly

public void writeBytes(String s) {
  int len=s != null? s.length() : 0;
  if(len > 0)
    ensureCapacity(len);
  for(int i = 0 ; i < len ; i++)
    write((byte)s.charAt(i));
}
origin: wildfly/wildfly

public void writeChars(String s) {
  int len=s != null? s.length() : 0;
  if(len > 0)
    ensureCapacity(len *2); // 2 bytes per char
  for(int i = 0 ; i < len ; i++) {
    int v = s.charAt(i);
    writeChar(v);
  }
}
origin: wildfly/wildfly

public void writeUTF(String str) {
  int strlen=str != null? str.length() : 0;
  if(strlen > 0)
    ensureCapacity(strlen *2 + 2);
origin: org.jboss.eap/wildfly-client-all

public void write(int b) {
  ensureCapacity(1);
  buf[pos++]=(byte)b;
}
origin: org.jboss.eap/wildfly-client-all

public void write(byte[] b, int off, int len) {
  if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) - b.length > 0))
    throw new IndexOutOfBoundsException(String.format("off=%d, len=%d, b.length=%d", off, len, b.length));
  ensureCapacity(len);
  System.arraycopy(b, off, buf, pos, len);
  pos+=len;
}
origin: org.jboss.eap/wildfly-client-all

public void writeChars(String s) {
  int len=s != null? s.length() : 0;
  if(len > 0)
    ensureCapacity(len *2); // 2 bytes per char
  for(int i = 0 ; i < len ; i++) {
    int v = s.charAt(i);
    writeChar(v);
  }
}
origin: org.jboss.eap/wildfly-client-all

public void writeBytes(String s) {
  int len=s != null? s.length() : 0;
  if(len > 0)
    ensureCapacity(len);
  for(int i = 0 ; i < len ; i++)
    write((byte)s.charAt(i));
}
origin: org.jboss.eap/wildfly-client-all

public void writeUTF(String str) {
  int strlen=str != null? str.length() : 0;
  if(strlen > 0)
    ensureCapacity(strlen *2 + 2);
org.jgroups.utilByteArrayDataOutputStreamensureCapacity

Javadoc

Grows the buffer; whether it grow linearly or exponentially depends on grow_exponentially

Popular methods of ByteArrayDataOutputStream

  • <init>
  • buffer
  • checkBounds
  • getBuffer
  • getByteBuffer
  • position
  • write
  • writeBoolean
  • writeByte
  • writeChar
  • writeInt
  • writeLong
  • writeInt,
  • writeLong,
  • writeShort,
  • writeUTF

Popular in Java

  • Making http requests using okhttp
  • getContentResolver (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • addToBackStack (FragmentTransaction)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now