@Test public void testEncodeAndDecodeEmptyString() { final DecoderImpl decoder = new DecoderImpl(); final EncoderImpl encoder = new EncoderImpl(decoder); AMQPDefinedTypes.registerAllTypes(decoder, encoder); final ByteBuffer buffer = ByteBuffer.allocate(64); encoder.setByteBuffer(buffer); decoder.setByteBuffer(buffer); encoder.writeString("a"); encoder.writeString(""); encoder.writeString("b"); buffer.clear(); TypeConstructor<?> stringType = decoder.readConstructor(); assertEquals(String.class, stringType.getTypeClass()); stringType.skipValue(); String result = decoder.readString(); assertEquals("", result); result = decoder.readString(); assertEquals("b", result); }
@Override public Class<String> getTypeClass() { return String.class; }
StringType extends AbstractPrimitiveType<String> { @Override public Class<String> getTypeClass() { return String.class; } }
StringType extends AbstractPrimitiveType<String> { @Override public Class<String> getTypeClass() { return String.class; } StringType(final EncoderImpl encoder, final DecoderImpl decoder); }
StringType extends AbstractPrimitiveType<String> { @Override public Class<String> getTypeClass() { return String.class; } StringType(final EncoderImpl encoder, final DecoderImpl decoder); @Override Class<String> getTypeClass(); @Override StringEncoding getEncoding(final String val); @Override StringEncoding getCanonicalEncoding(); @Override Collection<StringEncoding> getAllEncodings(); }
StringType extends AbstractPrimitiveType<String> { @Override public Class<String> getTypeClass() { return String.class; } StringType(final EncoderImpl encoder, final DecoderImpl decoder); @Override Class<String> getTypeClass(); @Override StringEncoding getEncoding(final String val); @Override StringEncoding getCanonicalEncoding(); @Override Collection<StringEncoding> getAllEncodings();  }