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

📄 eventservice.java

📁 一个基于PlaceLab的室内和室外的智能导航系统
💻 JAVA
字号:
/* * Created on Sep 16, 2004 * */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 java.io.PrintStream;import org.placelab.core.PlacelabProperties;public class EventService implements BluetoothService {	public String getName() {		return "Event Log Downloader";	}		public byte getServiceType() {		return BluetoothService.ACTIVITY_UPLOAD_SERVICE;	}	public void newClient(DataInputStream in, DataOutputStream out) {		System.out.println("Receiving event log...");				File f = null;				for (int i = 0;; i++) {			f = new File(PlacelabProperties.get("placelab.datadir") + File.separator + 					"event-log-" + i + ".txt");			if (!f.exists())				break;		}				try {			System.out.println("Saving to " + f.getName());			PrintStream ps = new PrintStream(new FileOutputStream(f));			//			String name = in.readUTF();//			String number = in.readUTF();//			ps.println(name + "|" + number);						int count = in.readInt();			while (count-- > 0) {				ps.println(in.readUTF());			}						ps.close();		} catch (IOException e) {			System.err.println("Saving failed: " + e);			e.printStackTrace();		}	}}

⌨️ 快捷键说明

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