Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Telnet Input Stream

Posted on 2004-04-05
3
Medium Priority
?
311 Views
Last Modified: 2006-11-17
Does anyone know a quick way to convert a TelnetInputStream to byte[]?

I am using the sun.net.ftp to do a get.  It returns a TIS.

thanks,

0
Comment
Question by:sladej
  • 3
3 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 1000 total points
ID: 10760398
Just read it into a ByteArrayOutputStream

ByteArrayOutputStream baos = new ByteArrayOutputStream();
int buf = -1;
while((buf = telnetIn.read()) > -1) {
     baos.write(buf);
}
telnetIn.close();
byte[] bytes = baos.toByteArray();
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10760401

    baos.write(buf);

should be


    baos.write((byte)buf);
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10767254
8-)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This video teaches viewers about errors in exception handling.
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question