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

📄 mresultwriter.java

📁 httptunnel.jar httptunnel java 源码
💻 JAVA
字号:
package net.jumperz.app.MRemedy;

import java.util.*;
import java.io.*;
import net.jumperz.util.*;

public class MResultWriter
extends MSingleThreadCommand
{
private static final MResultWriter instance = new MResultWriter();

private int lastIndex = -1;
private Map indexResultMap = new HashMap();
//--------------------------------------------------------------------------------
public static MResultWriter getInstance()
{
return instance;
}
//--------------------------------------------------------------------------------
private MResultWriter()
{
mutex = new Object();
}
//--------------------------------------------------------------------------------
public void execute2()
{
while( true )
	{
	Integer nextIndex = new Integer( lastIndex + 1 );
	if( indexResultMap.containsKey( nextIndex ) )
		{
		try
			{
			System.out.write( ( ( String )indexResultMap.get( nextIndex ) ).getBytes( MCharset.CS_ISO_8859_1 ) );		
			System.out.write( 0x0A );
			}
		catch( IOException e )
			{
			e.printStackTrace();
			}

		lastIndex++;

		synchronized( indexResultMap )
			{
			indexResultMap.remove( nextIndex );
			}
		}
	else
		{
		break;
		}
	}
}
//--------------------------------------------------------------------------------
public void putResult( Integer index, String result )
{
synchronized( indexResultMap )
	{
	indexResultMap.put( index, result );
	}

synchronized( mutex )
	{
	mutex.notify();
	}
}
//--------------------------------------------------------------------------------
public void breakCommand()
{
}
//--------------------------------------------------------------------------------
}

⌨️ 快捷键说明

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