Java Read file, send out socket without using BufferedReader

Posted on 2008-11-18
Last Modified: 2013-12-29
I am stumped on how to accomplish the reading of a file with subsequent writes to a socket all without using BufferedReader as I have to avoid the elimination of the CRLFs embedded in the file.

Thank You
Question by:dennisk1718
    LVL 16

    Accepted Solution

    If you need to take the file "verbatim", byte by byte, you can simply read it with a FileInputStream. You can use the read method to read a specified number of bytes, which can then be written to the socket.

    Or do you need to read the file line by line for some reason?
    LVL 16

    Expert Comment

    Did that help you solve the problem?

    If so, it is now time to grade the question and close it.

    If not, a clarifying question may help.

    Author Closing Comment


    Thank You

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    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…
    Join Greg Farro and Ethan Banks from Packet Pushers ( and Greg Ross from Paessler ( for a discussion about smart network …
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    This video teaches viewers about errors in exception handling.

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now