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 7778829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:29:48+00:00 2026-06-01T18:29:48+00:00

I am trying to write a double[] into a file in HDFS, and later

  • 0

I am trying to write a double[] into a file in HDFS, and later on, I will need to read it back from the file and convert it back to the double[]. Does anyone here know how to do it?

Thanks,

  • 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-01T18:29:49+00:00Added an answer on June 1, 2026 at 6:29 pm

    ObjectOutputStream

    An ObjectOutputStream writes primitive data types and graphs of Java
    objects to an OutputStream. The objects can be read (reconstituted)
    using an ObjectInputStream. Persistent storage of objects can be
    accomplished by using a file for the stream. If the stream is a
    network socket stream, the objects can be reconstituted on another
    host or in another process.

    Only objects that support the java.io.Serializable interface can be
    written to streams. The class of each serializable object is encoded
    including the class name and signature of the class, the values of the
    object’s fields and arrays, and the closure of any other objects
    referenced from the initial objects.

    The method writeObject is used to write an object to the stream. Any
    object, including Strings and arrays, is written with writeObject.
    Multiple objects or primitives can be written to the stream. The
    objects must be read back from the corresponding ObjectInputstream
    with the same types and in the same order as they were written.

    Primitive data types can also be written to the stream using the
    appropriate methods from DataOutput. Strings can also be written using
    the writeUTF method.

    ObjectInputStream

    An ObjectInputStream deserializes primitive data and objects
    previously written using an ObjectOutputStream.

    ObjectOutputStream and ObjectInputStream can provide an application
    with persistent storage for graphs of objects when used with a
    FileOutputStream and FileInputStream respectively. ObjectInputStream
    is used to recover those objects previously serialized. Other uses
    include passing objects between hosts using a socket stream or for
    marshaling and unmarshaling arguments and parameters in a remote
    communication system.

    ObjectInputStream ensures that the types of all objects in the graph
    created from the stream match the classes present in the Java Virtual
    Machine. Classes are loaded as required using the standard mechanisms.

    For example, I can save a key generator for encrypting data in this manner:

    public static void saveKeyToFile(SecretKey key)
            throws FileNotFoundException, IOException {
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(
                "/path/to/mysavedobject"));
        oos.writeObject(key);
        oos.close();
    }
    
    public static SecretKey getKeyFromFile(String dir) throws IOException,
            ClassNotFoundException {
        if (dir == null) { 
            dir = "/path/to/mysavedobject";
        }
        SecretKey key = null;
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream(
                dir));
        key = (SecretKey) ois.readObject();
        ois.close();
        return key;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a program that reads in entries from a file into
Trying to write a couple of functions that will encrypt or decrypt a file
Trying to write a javascript bookmarklet to jump from a front end link into
im trying to write an app that will display a list off lines from
I need to read a line like this from a file: 5 Chair 12.49
I am trying to write some content into file inside my spring controller. Before
I'm trying to write multiple lines into a file but only one record of
I'm working on an application in C# and need to read and write from
I am trying to write a method that converts from engineering notation to double
Im trying to write a single byte at a certain location in a file.

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.