Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Telnet Input Stream

Posted on 2004-04-05
3
Medium Priority
?
309 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
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…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

721 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