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

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

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

origin: apache/mina

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

private IoBuffer putChar(Pointer index, char value) {
  return putShort(index, (short) value);
}
origin: apache/mina

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

@Test
public void testShort() {
  for (ByteOrder bo : new ByteOrder[] { ByteOrder.BIG_ENDIAN, ByteOrder.LITTLE_ENDIAN }) {
    ByteBuffer bb = (ByteBuffer) ByteBuffer.allocate(3).order(bo).putShort((short) 12345).rewind();
    IoBuffer ioBuffer = IoBuffer.wrap(bb).order(bo);
    assertEquals(3, ioBuffer.capacity());
    ioBuffer.extend(1);
    ioBuffer.position(2);
    assertEquals(4, ioBuffer.capacity());
    ioBuffer.putShort((short) -23456);
    ioBuffer.rewind();
    assertEquals(12345, ioBuffer.getShort());
    assertEquals(-23456, ioBuffer.getShort());
    ioBuffer.rewind();
    ioBuffer.putShort(1, (short) 12345);
    assertEquals((short) 12345, ioBuffer.getShort(1));
    try {
      ioBuffer.putShort(3, (short) 1);
      fail("Not enough place on the buffer");
    } catch (BufferUnderflowException e) {
      // Should come here
    }
    try {
      ioBuffer.getShort(3);
      fail("Not enough place on the buffer");
    } catch (BufferUnderflowException e) {
      // Should come here
    }
  }
}
org.apache.mina.codecIoBufferputShort

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

  • Running tasks concurrently on multiple threads
  • getSharedPreferences (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • setRequestProperty (URLConnection)
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Top plugins for Android Studio
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