| 
					
				 | 
			
			
				@@ -4,6 +4,7 @@ import java.io.DataOutputStream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.io.File; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.io.FileOutputStream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.io.IOException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.io.OutputStream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.nio.ByteBuffer; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.nio.CharBuffer; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.nio.charset.Charset; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -35,8 +36,8 @@ import io.netty.channel.ChannelInboundHandlerAdapter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Component 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class DiscardServerHandler extends ChannelInboundHandlerAdapter { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private String dataPath = "/home/service/collector_watch/rawdata/"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //private String dataPath = "/home/service/collector_watch/rawdata/"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private String dataPath = "D:\\work\\rawdata1\\"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private static final Logger logger = LoggerFactory.getLogger(DiscardServerHandler.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private static final Long TEN_M = 10485760l; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private static final String prefixName = "watch"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -206,11 +207,11 @@ public class DiscardServerHandler extends ChannelInboundHandlerAdapter { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void writeDevice2File(File file, String deviceStr){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Integer length = deviceStr.getBytes().length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            DataOutputStream dataOutputStream = new DataOutputStream(new FileOutputStream(file, true)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            dataOutputStream.write(int2bytes(length));; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            dataOutputStream.writeUTF(deviceStr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            dataOutputStream.flush(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            dataOutputStream.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            OutputStream outputStream = new FileOutputStream(file, true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            outputStream.write(int2bytes(length));; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            outputStream.write(deviceStr.getBytes()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            outputStream.flush(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            outputStream.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } catch (IOException e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -241,17 +242,19 @@ public class DiscardServerHandler extends ChannelInboundHandlerAdapter { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 【Receive from 223.104.255.118 :61922】:[3G*3918197044*000D*LK,12642,0,93] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public static void main(String[] args) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Device device = new Device(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        device.setDeviceId("3918197044"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        device.setElectric(11.2d); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        device.setItemState("125"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        device.setLat(24.4441); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        device.setLng(114.223); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        device.setSpeed(21.2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        device.setStep(12); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        device.setTerminalState(12); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        device.setTimestamp(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        new DiscardServerHandler().dataStorage(device); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (int i = 0; i < 100; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Device device = new Device(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            device.setDeviceId("3918197044"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            device.setElectric(11.2d); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            device.setItemState("125"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            device.setLat(24.4441); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            device.setLng(114.223); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            device.setSpeed(21.2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            device.setStep(12); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            device.setTerminalState(12); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            device.setTimestamp(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            new DiscardServerHandler().dataStorage(device); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public static String byteBufferToString(ByteBuffer buffer) { 
			 |