final Token token) final String characterEncoding = token.encoding().characterEncoding(); switch (token.encoding().characterEncoding())
enum CodecType { DECODER, ENCODER }
private void generateCharacterEncoding( final StringBuilder sb, final String typeName, final String propertyName, final Token token) { if (token.encoding().primitiveType() == CHAR && token.arrayLength() > 1) { sb.append(String.format( "\nfunc (%1$s *%2$s) %3$sCharacterEncoding() string {\n" + "\treturn \"%4$s\"\n" + "}\n", Character.toLowerCase(typeName.charAt(0)), typeName, propertyName, token.encoding().characterEncoding())); } }
try final String characterEncoding = typeToken.encoding().characterEncoding(); if (null == characterEncoding)
public void onVarData( final Token fieldToken, final DirectBuffer buffer, final int bufferIndex, final int length, final Token typeToken) { try { property(fieldToken.name()); doubleQuote(); final byte[] tempBuffer = new byte[length]; buffer.getBytes(bufferIndex, tempBuffer, 0, length); output.append(new String(tempBuffer, 0, length, typeToken.encoding().characterEncoding())); doubleQuote(); next(); } catch (final UnsupportedEncodingException ex) { ex.printStackTrace(); } }
private void generateVarData( final StringBuilder sb, final String typeName, final List<Token> tokens) { for (int i = 0, size = tokens.size(); i < size;) { final Token token = tokens.get(i); if (token.signal() != Signal.BEGIN_VAR_DATA) { throw new IllegalStateException("tokens must begin with BEGIN_VAR_DATA: token=" + token); } final String propertyName = toUpperFirstChar(token.name()); final Token lengthToken = Generators.findFirst("length", tokens, i); final int lengthOfLengthField = lengthToken.encodedLength(); final Token varDataToken = Generators.findFirst("varData", tokens, i); final String characterEncoding = varDataToken.encoding().characterEncoding(); generateFieldMetaAttributeMethod(sb, typeName, propertyName, token); generateVarDataDescriptors(sb, token, typeName, propertyName, characterEncoding, lengthOfLengthField); i += token.componentTokenCount(); } }
final String characterEncoding = varData.get(i + 3).encoding().characterEncoding(); final String varDataName = formatPropertyName(varDataToken.name()); append(sb, indent, "builder.append(\"" + varDataName + Separators.KEY_VALUE + "\");");
generateFieldSinceVersionMethod(sb, token, indent); final String characterEncoding = tokens.get(i + 3).encoding().characterEncoding(); generateCharacterEncodingMethod(sb, token.name(), characterEncoding, indent); generateFieldMetaAttributeMethod(sb, token, indent);
generateCharacterEncodingMethod(sb, propertyName, encoding.characterEncoding(), indent); fieldLength, offset, fieldLength, fieldLength, charset(encoding.characterEncoding()))); if (encoding.characterEncoding().contains("ASCII"))
final String characterEncoding = varDataToken.encoding().characterEncoding(); generateCharacterEncodingMethod(sb, token.name(), characterEncoding, indent); generateFieldMetaAttributeMethod(sb, token, indent);
final String characterEncoding = varDataToken.encoding().characterEncoding(); generateCharacterEncodingMethod(sb, token.name(), characterEncoding, indent); generateFieldMetaAttributeMethod(sb, token, indent);
generateCharacterEncodingMethod(sb, propertyName, token.encoding().characterEncoding(), indent);
final Token lengthToken = Generators.findFirst("length", tokens, i); final Token varDataToken = Generators.findFirst("varData", tokens, i); final String characterEncoding = varDataToken.encoding().characterEncoding(); final int lengthOfLengthField = lengthToken.encodedLength(); final String lengthCppType = cppTypeName(lengthToken.encoding().primitiveType());
private void assertEqual(final Token lhs, final Token rhs) { assertThat(lhs.name(), is(rhs.name())); assertThat(lhs.version(), is(rhs.version())); assertThat(lhs.offset(), is(rhs.offset())); assertThat((long)lhs.id(), is((long)rhs.id())); assertThat(lhs.signal(), is(rhs.signal())); assertThat(lhs.encodedLength(), is(rhs.encodedLength())); assertThat(lhs.encoding().byteOrder(), is(rhs.encoding().byteOrder())); assertThat(lhs.encoding().primitiveType(), is(rhs.encoding().primitiveType())); assertThat(lhs.encoding().presence(), is(rhs.encoding().presence())); assertThat(lhs.encoding().constValue(), is(rhs.encoding().constValue())); assertThat(lhs.encoding().minValue(), is(rhs.encoding().minValue())); assertThat(lhs.encoding().maxValue(), is(rhs.encoding().maxValue())); assertThat(lhs.encoding().nullValue(), is(rhs.encoding().nullValue())); assertThat(lhs.encoding().characterEncoding(), is(rhs.encoding().characterEncoding())); assertThat(lhs.encoding().epoch(), is(rhs.encoding().epoch())); assertThat(lhs.encoding().timeUnit(), is(rhs.encoding().timeUnit())); assertThat(lhs.encoding().semanticType(), is(rhs.encoding().semanticType())); }
encoding.characterEncoding(), characterEncodingCharacterEncoding()); tokenEncoder.putCharacterEncoding(charEncodingBytes, 0, charEncodingBytes.length);
enum CodecType { DECODER, ENCODER }
enum CodecType { DECODER, ENCODER }
private void generateCharacterEncoding( final StringBuilder sb, final String typeName, final String propertyName, final Token token) { if (token.encoding().primitiveType() == CHAR && token.arrayLength() > 1) { sb.append(String.format( "\nfunc (%1$s *%2$s) %3$sCharacterEncoding() string {\n" + "\treturn \"%4$s\"\n" + "}\n", Character.toLowerCase(typeName.charAt(0)), typeName, propertyName, token.encoding().characterEncoding())); } }
private void generateCharacterEncoding( final StringBuilder sb, final String typeName, final String propertyName, final Token token) { if (token.encoding().primitiveType() == CHAR && token.arrayLength() > 1) { sb.append(String.format( "\nfunc (%1$s *%2$s) %3$sCharacterEncoding() string {\n" + "\treturn \"%4$s\"\n" + "}\n", Character.toLowerCase(typeName.charAt(0)), typeName, propertyName, token.encoding().characterEncoding())); } }
public void onVarData(Token fieldToken, DirectBuffer buffer, int bufferIndex, int length, Token typeToken) { try { property(fieldToken); doubleQuote(); buffer.getBytes(bufferIndex, tempBuffer, 0, length); append(new String(tempBuffer, 0, length, typeToken.encoding().characterEncoding())); doubleQuote(); next(); } catch (final UnsupportedEncodingException ex) { ex.printStackTrace(); return; } }