Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7992573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:36:05+00:00 2026-06-04T13:36:05+00:00

My teacher said that in file server program ObjectInputStreamReader is compulsory to write. When

  • 0

My teacher said that in file server program ObjectInputStreamReader is compulsory to write. When I asked the reason then he said me it is comfortable for file server program. I am thinking that it is not necessary reason. Why InputStreamReader or other alternatives can not be used? what is the advantage of ObjectInputStreamReader over InputStreamReader.

Here code for client/server:

public class Client {
    public static void main(String[] args) {
        Socket s = null;
        ObjectInputStream ois = null;
        ObjectOutputStream oos = null;
        Scanner sc = new Scanner(System.in);

        String data = "";
        try {
            s = new Socket("localhost", 1234);
            System.out.println("client is connectd");

            ois = new ObjectInputStream(s.getInputStream());
            String jai = (String) ois.readObject();
            System.out.println("DATA from SERVER:" + jai);
            oos = new ObjectOutputStream(s.getOutputStream());
        } catch (Exception e) {
            e.printStackTrace();
        }

        System.out.println("Enter file name:");
        try {
            String fil = (String) sc.next();
            OutputStream pw = new FileOutputStream(fil + ".new");
            oos.writeObject(fil);
            data = (String) ois.readObject();
            pw.write(data.getBytes());
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
        System.out.println("Content of file:" + data);
    }
}

Can any one say what is actual reason ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:36:06+00:00Added an answer on June 4, 2026 at 1:36 pm

    I think you mean ObjectInputStream and BufferedInputStream (not readers).

    ObjectInputStream wraps input stream and provides typed methods that allow reading data of certain type from the stream. For example readDouble(), readObject() etc.

    BufferedInputStream does not provide additional API (comparing to regular InputStream). The only thing it does is buffering of data, i.e. it reads data chunk-by-chunk that is much more efficient way than reading byte-by-byte.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My teacher asked me to do a program using execlp that will do the
Our computer science teacher once said that for some reason it is faster to
My teacher has asked me to write a program in C# to handle Array
My teacher gave me this question: Write a program that does the following: Enter
My teacher's notes said There is a tags file that can be built which
I can't, for the life of me, remember what exactly our teacher said that
My teacher in an upper level Java class on threading said something that I
My Java teacher (High school course) was talking about loops and she said that
UML Diagram : https://i.stack.imgur.com/ajsVQ.png My OOP teacher said that we could implement something like
My teacher told us that there is a default class in Java for binary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.