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

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

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

origin: apache/mina

/**
 * @see ByteBuffer#getShort()
 */
public short getShort() {
  return getShort(position);
}
origin: apache/mina

private char getChar(Pointer position) {
  return (char) getShort(position);
}
origin: apache/mina

/**
 * @see ByteBuffer#getShort(int)
 */
public long getShort(int index) {
  return getShort(getPointerByPosition(index));
}
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.codecIoBuffergetShort

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
  • hasRemaining
  • getLong,
  • hasRemaining,
  • isDirect,
  • limit,
  • order,
  • position,
  • put,
  • putChar,
  • putDouble

Popular in Java

  • Finding current android device location
  • setContentView (Activity)
  • addToBackStack (FragmentTransaction)
  • putExtra (Intent)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • CodeWhisperer alternatives
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