Search in sources :

Example 1 with ByteBuffer

use of org.smpp.util.ByteBuffer in project opensmpp by OpenSmpp.

the class TLVShort method getValueData.

protected ByteBuffer getValueData() throws ValueNotSetException {
    ByteBuffer valueBuf = new ByteBuffer();
    valueBuf.appendShort(getValue());
    return valueBuf;
}
Also used : ByteBuffer(org.smpp.util.ByteBuffer)

Example 2 with ByteBuffer

use of org.smpp.util.ByteBuffer in project opensmpp by OpenSmpp.

the class TLVString method getValueData.

public ByteBuffer getValueData() throws ValueNotSetException {
    ByteBuffer valueBuf = new ByteBuffer();
    valueBuf.appendCString(getValue());
    return valueBuf;
}
Also used : ByteBuffer(org.smpp.util.ByteBuffer)

Example 3 with ByteBuffer

use of org.smpp.util.ByteBuffer in project opensmpp by OpenSmpp.

the class ByteBufferTest method testAppendBufferWithEmptyDoesNothing.

@Test
public void testAppendBufferWithEmptyDoesNothing() {
    buffer.appendBuffer(new ByteBuffer(new byte[] {}));
    assertNull(buffer.getBuffer());
}
Also used : ByteBuffer(org.smpp.util.ByteBuffer) Test(org.junit.Test)

Example 4 with ByteBuffer

use of org.smpp.util.ByteBuffer in project opensmpp by OpenSmpp.

the class ByteBufferTest method testRemoveBufferRemovesFirst.

@Test
public void testRemoveBufferRemovesFirst() throws Exception {
    buffer = bufferOf(A, B, C);
    ByteBuffer b = buffer.removeBuffer(2);
    assertArrayEquals(new byte[] { A, B }, b.getBuffer());
    assertBufferMatches(C);
}
Also used : ByteBuffer(org.smpp.util.ByteBuffer) Test(org.junit.Test)

Example 5 with ByteBuffer

use of org.smpp.util.ByteBuffer in project opensmpp by OpenSmpp.

the class ByteBufferTest method testAppendStringWithZeroCount.

@Test
public void testAppendStringWithZeroCount() {
    buffer = new ByteBuffer(new byte[] {});
    buffer.appendString(ABC, 0);
    assertBufferMatches(new byte[] {});
}
Also used : ByteBuffer(org.smpp.util.ByteBuffer) Test(org.junit.Test)

Aggregations

ByteBuffer (org.smpp.util.ByteBuffer)21 Test (org.junit.Test)9 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 PDU (org.smpp.pdu.PDU)2 UnknownCommandIdException (org.smpp.pdu.UnknownCommandIdException)2 HeaderIncompleteException (org.smpp.pdu.HeaderIncompleteException)1 MessageIncompleteException (org.smpp.pdu.MessageIncompleteException)1 PDUException (org.smpp.pdu.PDUException)1 NotEnoughDataInByteBufferException (org.smpp.util.NotEnoughDataInByteBufferException)1