@Test public void toBytes1() { String test = "testing"; byte[] result = JCAChannelHandler.toBytes(test); assertThat(new String(result), equalTo("testing\0")); }
static byte[] toBytes(final String text) { final byte[] bytes = new byte[text.length() + 1]; System.arraycopy(text.getBytes(), 0, bytes, 0, text.length()); bytes[text.length()] = '\0'; return bytes; }
JCAChannelHandler extends MultiplexedChannelHandler<JCAConnectionPayload, JCAMessagePayload> { static byte[] toBytes(final String text) { final byte[] bytes = new byte[text.length() + 1]; System.arraycopy(text.getBytes(), 0, bytes, 0, text.length()); bytes[text.length()] = '\0'; return bytes; } }
JCAChannelHandler extends MultiplexedChannelHandler<JCAConnectionPayload, JCAMessagePayload> { static byte[] toBytes(final String text) { final byte[] bytes = new byte[text.length() + 1]; System.arraycopy(text.getBytes(), 0, bytes, 0, text.length()); bytes[text.length()] = '\0'; return bytes; } JCAChannelHandler(String channelName, JCADataSource jcaDataSource); }
JCAChannelHandler extends MultiplexedChannelHandler<JCAConnectionPayload, JCAMessagePayload> { static byte[] toBytes(final String text) { final byte[] bytes = new byte[text.length() + 1]; System.arraycopy(text.getBytes(), 0, bytes, 0, text.length()); bytes[text.length()] = '\0'; return bytes; } JCAChannelHandler(String channelName, JCADataSource jcaDataSource); boolean isPutCallback(); boolean isLongString(); JCADataSource getJcaDataSource(); String getJcaChannelName(); @Override synchronized void connect(); @Override synchronized void disconnect(); @Override void write(Object newValue, final ChannelWriteCallback callback); @Override synchronized Map<String, Object> getProperties(); }
JCAChannelHandler extends MultiplexedChannelHandler<JCAConnectionPayload, JCAMessagePayload> { static byte[] toBytes(final String text) { final byte[] bytes = new byte[text.length() + 1]; System.arraycopy(text.getBytes(), 0, bytes, 0, text.length()); bytes[text.length()] = '\0'; return bytes; } JCAChannelHandler(String channelName, JCADataSource jcaDataSource); boolean isPutCallback(); boolean isLongString(); JCADataSource getJcaDataSource(); String getJcaChannelName(); @Override synchronized void connect(); @Override synchronized void disconnect(); @Override void write(Object newValue, final ChannelWriteCallback callback); @Override synchronized Map<String, Object> getProperties(); static Pattern longStringPattern; }