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

  • Running tasks concurrently on multiple threads
  • getContentResolver (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • requestLocationUpdates (LocationManager)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • JCheckBox (javax.swing)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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