@Test public void example() throws IOException, T212FormatException { String h212 = "##0136ST=32;CN=2011;PW=123456;MN=LD130133000015;CP=&&DataTime=20160824003817;B01-Rtd=36.91;011-Rtd=231.0,011-Flag=N;060-Rtd=1.803,060-Flag=N&&4980\r\n"; T212Mapper mapper = new T212Mapper() .enableDefaultVerifyFeatures() .enableDefaultParserFeatures(); Data data = mapper.readData(h212); data.setPw("000000"); String result = mapper.writeDataAsString(data); assertEquals(result,"##0136ST=32;CN=2011;PW=000000;MN=LD130133000015;CP=&&DataTime=20160824003817;011-Rtd=231.0,011-Flag=N;B01-Rtd=36.91;060-Rtd=1.803,060-Flag=N&&1dc0\r\n"); }
public char[] readData(int segmentLen) throws T212FormatException, IOException { char[] segment = new char[segmentLen]; count = reader.read(segment); VerifyUtil.verifyLen(count,segmentLen, PacketElement.DATA); return segment; }
T212Parser implements Configured<T212Parser>, Closeable { public char[] readData(int segmentLen) throws T212FormatException, IOException { char[] segment = new char[segmentLen]; count = reader.read(segment); VerifyUtil.verifyLen(count,segmentLen, PacketElement.DATA); return segment; } }
T212Parser implements Configured<T212Parser>, Closeable { public char[] readData(int segmentLen) throws T212FormatException, IOException { char[] segment = new char[segmentLen]; count = reader.read(segment); VerifyUtil.verifyLen(count,segmentLen, PacketElement.DATA); return segment; } T212Parser(Reader reader); }
T212Parser implements Configured<T212Parser>, Closeable { public char[] readData(int segmentLen) throws T212FormatException, IOException { char[] segment = new char[segmentLen]; count = reader.read(segment); VerifyUtil.verifyLen(count,segmentLen, PacketElement.DATA); return segment; } T212Parser(Reader reader); void setParserFeature(int parserFeature); char[] readHeader(); char[] readDataLen(); int readInt32(int radix); char[] readData(int segmentLen); char[] readCrc(); char[] readFooter(); char[] readDataAndCrc(int dataLen); @Override void configured(Configurator<T212Parser> configurator); @Override void close(); static int crc16Checkout(char[] msg, int length); }
T212Parser implements Configured<T212Parser>, Closeable { public char[] readData(int segmentLen) throws T212FormatException, IOException { char[] segment = new char[segmentLen]; count = reader.read(segment); VerifyUtil.verifyLen(count,segmentLen, PacketElement.DATA); return segment; } T212Parser(Reader reader); void setParserFeature(int parserFeature); char[] readHeader(); char[] readDataLen(); int readInt32(int radix); char[] readData(int segmentLen); char[] readCrc(); char[] readFooter(); char[] readDataAndCrc(int dataLen); @Override void configured(Configurator<T212Parser> configurator); @Override void close(); static int crc16Checkout(char[] msg, int length); static char[] HEADER; static char[] FOOTER; }