Tabnine Logo
IoBuffer.putLong
Code IndexAdd Tabnine to your IDE (free)

How to use
putLong
method
in
org.apache.mina.codec.IoBuffer

Best Java code snippets using org.apache.mina.codec.IoBuffer.putLong (Showing top 4 results out of 315)

origin: apache/mina

/**
 * @see ByteBuffer#putLong(long)
 */
public IoBuffer putLong(long value) {
  return putLong(position, value);
}
origin: apache/mina

private IoBuffer putDouble(Pointer pos, double value) {
  return putLong(pos, Double.doubleToLongBits(value));
}
origin: apache/mina

/**
 * @see ByteBuffer#putLong(int, long)
 */
public IoBuffer putLong(int index, long value) {
  return putLong(getPointerByPosition(index), value);
}
origin: apache/mina

@Test
public void testLong() {
  for (ByteOrder bo : new ByteOrder[] { ByteOrder.BIG_ENDIAN, ByteOrder.LITTLE_ENDIAN }) {
    ByteBuffer bb = (ByteBuffer) ByteBuffer.allocate(9).order(bo).putLong(123456789012l).rewind();
    IoBuffer ioBuffer = IoBuffer.wrap(bb).order(bo);
    assertEquals(9, ioBuffer.capacity());
    ioBuffer.extend(7);
    ioBuffer.position(8);
    assertEquals(16, ioBuffer.capacity());
    ioBuffer.putLong(-23456789023l);
    ioBuffer.rewind();
    assertEquals(123456789012l, ioBuffer.getLong());
    assertEquals(-23456789023l, ioBuffer.getLong());
    ioBuffer.rewind();
    ioBuffer.putLong(4, 1234567890);
    assertEquals(1234567890, ioBuffer.getLong(4));
    try {
      ioBuffer.putLong(9, 1);
      fail("Not enough place on the buffer");
    } catch (BufferUnderflowException e) {
      // Should come here
    }
    try {
      ioBuffer.getLong(9);
      fail("Not enough place on the buffer");
    } catch (BufferUnderflowException e) {
      // Should come here
    }
  }
}
org.apache.mina.codecIoBufferputLong

Popular methods of IoBuffer

  • asInputStream
    Provides an input stream which is actually reading the IoBufferinstance. Further reads on the return
  • get
  • remaining
  • add
    Add one or more ByteBuffer to the current IoBuffer
  • array
  • capacity
  • getChar
  • getDouble
  • getFloat
  • getInt
  • getLong
  • getShort
  • getLong,
  • getShort,
  • hasRemaining,
  • isDirect,
  • limit,
  • order,
  • position,
  • put,
  • putChar,
  • putDouble

Popular in Java

  • Making http post requests using okhttp
  • runOnUiThread (Activity)
  • getApplicationContext (Context)
  • getExternalFilesDir (Context)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Best plugins for Eclipse
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