⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 locationservice.java

📁 一个基于PlaceLab的室内和室外的智能导航系统
💻 JAVA
字号:
package org.placelab.midp.server;import java.io.DataInputStream;import java.io.DataOutputStream;import java.io.File;import java.io.FileOutputStream;import java.io.IOException;import org.placelab.core.PlacelabProperties;/** * Upload service for new location format used in sun valley. */public class LocationService implements BluetoothService {		public void newClient (DataInputStream in, DataOutputStream out) {		File f = null;				for (int i = 0;; i++) {			f = new File(PlacelabProperties.get("placelab.datadir") + File.separator + 					"locations-" + i + ".txt");						if (!f.exists())				break;		}		try {			System.out.println("Saving to " + f.getName());			DataOutputStream dos = new DataOutputStream(new FileOutputStream(f));						int nRecords = in.readInt();			System.out.println("Number of records: " + nRecords);						for (int i=1;i<=nRecords;i++) {				System.out.println("Receiving record # " + i);								int size = in.readInt();								dos.writeInt(size);								for (int b=0;b<size;b++) 					dos.write(in.read());							}						} catch (IOException e) {			System.err.println("Failed: " + e);			e.printStackTrace();		}			}		public byte getServiceType () {		return BluetoothService.LOCATION_UPLOAD_SERVICE;	}		public String getName () {		return "Location Upload Service";	}	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -