commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thufir <hawat.thu...@gmail.com>
Subject IOUtil.java uses net.io.Util; reading a live InputStream
Date Sat, 31 Aug 2013 03:15:26 GMT
I'm trying to figure out ho IOUtil.java:

http://svn.apache.org/repos/asf/commons/proper/net/trunk/src/main/java/examples/util/IOUtil.java

uses org.apache.commons.net.io.Util and how to use that API.  Can I use


     copyStream

     public static final long copyStream(InputStream source,
                   OutputStream dest)
                                  throws CopyStreamException

     Same as copyStream(source, dest, DEFAULT_COPY_BUFFER_SIZE);

     Throws:
         CopyStreamException



http://commons.apache.org/proper/commons-net/apidocs/org/apache/commons/net/io/Util.html#copyStream%28java.io.InputStream,%20java.io.OutputStream%29


in order to capture the stream *as it comes in* through 
org.apache.commons.net.telnet.TelnetClient?

I see how the demo reads and writes to the console concurrently (well, 
with threads, so that it appears concurrent).  How can I emulate that so 
that, while that's going, a log file is being written to so that if the 
stream closes suddenly, or the application crashes, the log file is there.

This is for a MUD (game) client, in order to parse the stream *live*.  
If it's a file, and you wait until EOF, that's easy enough.  But how do 
you read the data *live* in such a way that it can be processed?



thanks,

Thufir

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message