LZ data compression/decompression
Demonstrates LZ compression decompression
AI
Podsumowanie AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Kod źródłowy
Upload
import java.net.*;
import java.io.*;
import java.util.*;
public class WebTest
{
public static void main (String[] args)
{
// initialize random seed
Random randomGen = new Random(new Date().getTime());
while(true)
{
try
{
// sleep for a random interval
Thread.currentThread().sleep(randomGen.nextInt(args.length>1?(new Integer(args[1]).intValue()):10000));
if(args.length>0)
{
// print the user supplied URL to the console window
System.out.println(args[0]);
// open URL connection
URLConnection urlConn = new URL(args[0]).openConnection();
urlConn.setUseCaches(false);
// read and print the content to the console window
InputStream in = urlConn.getInputStream();
byte buf[] = new byte[4096];
int nSize = in.read(buf);
while(nSize>=0)
{
System.out.print(new String(buf,0,nSize));
nSize = in.read(buf);
}
System.out.print("\r\n");
}
else return;
}
catch(Exception e)
{
// print error message
System.out.println("Exception: "+e.getMessage());
}
}
}
}
Oryginalne komentarze (3)
Odzyskane z Wayback Machine