Please Come IN! IanSchneider. About random access serialized objects.

Hi,I'm a freshman.
I have a question about serialized objects.
If I useing writeObject() serialize objects into a file in order,I can gain them with readObject() in the same order. But if I want to random access these serialized objects rather than one by one,how to do?
Mr IanSchneider said "write all your objects into the same file using normal io techniques and you can still generate an index and acheive random access". It seems easy,but how to generate index and use it to acheive random access? Please write something in detail,Thank you in advance!
EXPECTING��

Have a look at this class: [ [u]WARNING: I just wrote this code, it hasn't been tested ]
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.RandomAccessFile;
import java.io.Serializable;
import java.util.ArrayList;
public class SerializedObjectWriter {
     private RandomAccessFile raf;
     private String filepath;
     private String mode;
     public SerializedObjectWriter(String filePath, String mode) throws FileNotFoundException {                         
          this.filepath = filePath;
          this.mode = mode;
          this.raf = new RandomAccessFile(filePath, mode);                         
     public void writeObject(Object o, long pos) throws IOException {
          raf.seek(pos);          
          final byte[] bytes = serialize((Serializable)o);     
          raf.writeInt(bytes.length);     
          raf.write(bytes);
     public void append(Object o) throws IOException {                    
          writeObject(o, raf.length());
     public Object readObject(long pos) throws IOException, ClassNotFoundException {
          raf.seek(pos);
          int len = raf.readInt();          
          final byte[] data = new byte[len];          
          raf.readFully(data);
          return deSerialize(data);
     public Object[] readAllObjects() throws IOException, ClassNotFoundException {          
          int pos = 0;          
          final ArrayList al = new ArrayList();
          while (true) {
               raf.seek(pos);
               final int len = raf.readInt();               
               final byte[] data = new byte[len];          
               raf.readFully(data);
               al.add(deSerialize(data));
               pos = (pos + len + 4);               
               if (pos >= raf.length()) break;               
          return al.toArray();
     public long length() throws IOException {
          return raf.length();
     public void reset() throws IOException {          
          raf.close();
          final boolean success = new File(filepath).delete();
          if (!success) throw new IOException("Failed to delete file");
          raf = new RandomAccessFile(filepath, mode);
     public void close() throws IOException {          
          raf.close();     
     private byte[] serialize(Serializable obj) throws IOException {
          final ByteArrayOutputStream baos = new ByteArrayOutputStream();
          final ObjectOutputStream oos = new ObjectOutputStream(baos);
          try {
               oos.writeObject(obj);
          } finally {
               oos.close();
          return baos.toByteArray();
     private Object deSerialize(byte[] data) throws IOException, ClassNotFoundException {
          final ByteArrayInputStream bais = new ByteArrayInputStream(data);     
          final BufferedInputStream bis = new BufferedInputStream(bais);
          final ObjectInputStream ois = new ObjectInputStream(bis);
          try {
               return (Serializable) ois.readObject();               
          } finally {
               ois.close();
     public static void main(String[] args) throws Exception {
          SerializedObjectWriter sor = new SerializedObjectWriter("C:\\test.ser", "rw");          
          sor.reset();
          sor.writeObject("Test 1", 0);                         
          sor.append("Test 2");               
          sor.append("Test 3");     
          Object[] objects = sor.readAllObjects();
          for (int i = 0; i < objects.length; i++) {
               System.out.println(objects);
          sor.close();

Similar Messages

  • Randomly accessing serialized objects

    Is there any way to access objects written to a file randomly. Serialization basically needs accessing objects in the same order as they are writeen. but i need to access object(s) in any order.
    Any suggestions on how to do so?

    I got this reply when i questioned the person
    incharge...may be theres much more to it than i
    could specify..........It could also be the case that the person in charge doesn't know that there are databases with small footprints implemented in java.
    so i would be glad if soemone
    could tell me what ever i plan to do with respect to
    random accessing is possible or not.....I think that you should be able to write all objects to one stream, and do a reset (on the object output stream) between each write, and write the start position of each object into an index file.
    I'm not sure that it will work, and having a data file + an index file is like having a small database (so why not download a database in that case)
    /Kaj

  • Can I please get some answers about fraudulent access to my itunes account?

    Today I found three unauthorized charges to my itunes account. Following those three charges, three other unauthorized charges appeared from other software/gaming companies (NCSoft, Valve Software, and TMA). I can't get an actual person to answer the phone at Apple and I would like some answers about unauthorized access to itunes accounts. When I called my bank to report the fraud, they told me they had already received several calls this morning about unauthorized itunes charges and then larger, unauthorized software charges.
    I would really like someone from Apple to address these questions, are they aware that there are problems with itunes accounts? If so, what is being done?

    I had the same EXACT thing happen to me. This morning I looked at my bank account & there was a $1 charge from itunes (not unusual, except this charge did not come with an email receipt as they usually do) there there are two $49.99 holds on my account from Valve Software. I cancelled my card with the bank right away. I tried calling Valve Software and a message comes on stating "if you have a question about a charge to your bank account, press 7". Happen much??? hmmmm I left a message with no return call as of yet. I'm guessing someone hacked my itunes account.. Valve Software is a video game website that sells downloads on there as well as through itunes. Apple should immediately cease dealings with this company as they sound VERY shady. This is not the first blog I've seen about it. Now it's going to take time to get my money back & now I have to get a new card/card number. Pain in the butt because some hacker needs a thrill. jerks...

  • Please tell me the way to access the object...........?

    when we are decleared a class variable,there should be an object in the memory.this object is the object of the java.obj.Class class.............
    my query is ..
    how to acess that object ?
    e.g.
    public class Basic
    public class Acsess{
    Basic b;//now please tell how access the object of class Basic.Class?......
    thanks and regurds

    I believe that the following example will help. You should also read this tutorial page:
    [Understanding Instance and Class Members|http://java.sun.com/docs/books/tutorial/java/javaOO/classvars.html]
    class A
        static String fie = "this is fie";
        String foo = "this is foo";
    public class B
        public static void main(String[] args)
            System.out.println(A.fie);
            A instance = new A();
            System.out.println(instance.fie); // Not recommended; does not
                                              // make it clear that fie is
                                              // a class (static) variable
            System.out.println(instance.foo);
    }

  • Writing data in Random Access File

    I was reading something about Random Access File coz I wanted to practice file handling in java. like, writing a data in a random access file, deleting the stored data, updating the stored data and search for a specific data.. I wasn't able to understand the example because the book gave a large program and it's not explained in detail. Is there any good tutorials that you could recommend for me?

    http://www.google.com/search?q=java+RandomAccessFile+example&hl=en&sourceid=gd&rls=GGLD,GGLD:2008-06,GGLD:en
    How did we get anything done before google?

  • Example of Serialized objects and non-Serialized objects

    Hi,
    Can you please tell me some of eample of Serialized objects and nonserialized objects in java and j2ee.
    Thanks
    alex.

    sravan123 wrote:
    Serialised objects are File ,all Collection classes , subclasses of Throwable and subclasses of Number.
    Non-Serialised objects are Connection,DataSourrce,Resultset , Thread and MathYou forgot to log in as another user before answering your own question incorrectly for reasons I'm currently unable to fathom

  • I am trying to update my itunes and iphone. Everytime I trie comes out a message about 'key access'. I've done all the steps from the support and nothing worked out. I cannot unistall and now I can't open it anymore also. What should i do, please?

    I am trying to update my itunes and iphone. Everytime I trie comes out a message about 'key access'. I've done all the steps from the support and nothing worked out. I cannot unistall and now I can't open it anymore also. What should i do, please?

    Isn't that only used when a PC will not boot?
    What options does booting with this give me?
    Thanks
    JK MCP
    Hi,
    USB recovery disk was used to recover your system when it encounter problem. You can try to use it to fix your problem instead reinstall system. However, there is no method to keep your program whenreinstall system.
    Roger Lu
    TechNet Community Support

  • Accessing Serialized Files randomly.

    I have a problem accessing serailized files randomly. I am using ObjectOutputStream to write objects to a file. I am using the ObjectInputStream to read the objects from the file. Both of these work fine if the order in which i Write objects is the same as the order in which I read Objects. But I need to skip few objects when reading objects from the file. I know API states that the order of writing and reading should be the same. But still is there any way where i can read serailized objects ramdomly form the file.
    Please help me with this it is very impritant of the project. We are trying to store tuples in the file. We are going to build an index over these tuples and then read the tuple that we need.
    Thankyou,
    Nishant

    You could wrap the ObjectOutputStream around a ByteArrayOutputStream to first serialize an object to a byte[] and then save that into a RandomAccessFile.
    The trick is to be able to tell where in the file each serialized object starts. Possibilities include:
    1) If your objects are known to serialize to a fixed size (or if there is a reasonable max size of the serialized object), you could pad each byte[] "record" you write to the file (eg, each object always uses 1K bytes). Then you can easily read back the i'th object byte[] and deserialize it.
    2) Design into your RandomAccessFile a "directory" section that keeps track of each stored object and it's starting byte address in the file.
    If the file needs to hold an arbitrary # of objects, the directory could support a special entry pointing to a "next" directory section later in the file.
    -Brian

  • Verizon Iphone 4 without sim card is locked because of forgotten passcode. Can't access serial number because of having no sim tray. Never synced with itunes. Recovery mode always comes up with an error. are there any solutions on resetting the phone?

    Verizon Iphone 4 without sim card is locked because of forgotten passcode. Can't access serial number because of having no sim tray. Never synced with itunes. Recovery mode always comes up with an error. are there any solutions on resetting the phone?

    Are you looking for the serial number or the IMEI? If the phone was active on your Verizon acount, Verizon can give you the IMEI.

  • I have had my apple tv 2 for about 3 months which work perfectly fine when I use it with my iPad 3 ー all of the sudden I get the HDCP Error!  I read the forms and done everything!  Apple I name a loyal customer, please come out with an update soon!

    I have had my apple tv 2 for about 3 months which work perfectly fine when I use it with my iPad 3 ー all of the sudden I get the HDCP Error!  I read the forms and done everything!  Apple I name a loyal customer, please come out with an update soon!

    That's one of the weird things.. it recognizes it maybe 10% of the time. And usually, only after I do the two-button reset. Problem is.. since it won't charge above 2%, anytime I try to do a restore or anything like that using iTunes, my device shuts off and I lose whatever progress I'd made.
    So, an update... after reading through a bunch of similar complaints (there are literally 1000's of them so there's NO WAY this isn't somehow ios7 related, thanks a lot APPLE ) I decided to try a restore in recovery mode. After 3 hours and several disconnections... I ended up having to just set it up as a new iPad, as the restore did nothing. Weirdly though... as I was doing the restore in recovery mode.. I noticed I'd gotten up to a 10% charge.. higher than it's been since September, so after setting it up as a new device, I turned it off and plugged it in using the wall charger. 2 hours later and I was up to 38%. Still not great, as my iPad, before ios7 could've fully charged twice in the amount of time it took for me to now get 28% more of a charge. And that's with a fully cleaned out device.. so that really ***** and I'm now more confused than ever.
    But I'm gonna leave it overnight charging and see what I come up with tomorrow. Sadly, when I paid $600 for it in February, I never expected to have to play "wait and see" with it...

  • Random Access help please

    How do you create a method which allows you to enter information for example on a employee, then add more records using random access file.. i'm looking for this everywhere, but i can't find a command line interface which does this..
    THanks

    a file is not a good idea; Use a relational database instead (MySQL for example).
    here is a sample code to use random access file:
    try {
            File f = new File("filename");
            RandomAccessFile raf = new RandomAccessFile(f, "rw");
            // Read a character
            char ch = raf.readChar();
            // Seek to end of file
            raf.seek(f.length());
            // Append to the end
            raf.writeChars("aString");
            raf.close();
        } catch (IOException e) {
        }

  • Random Access File not working, Need Help!!!!

    I am having trouble creating and displaying a Random Access File for hardware tools. I have included the code below in eight files:
    // Exercise 14.11: HardwareRecord.java
    package org.egan; // packaged for reuse
    public class HardwareRecord
      private int recordNumber;
      private String toolName;
      private int quantity;
      private double cost;
      // no-argument constructor calls other constructor with default values
      public HardwareRecord()
        this(0,"",0,0.0); // call four-argument constructor
      } // end no-argument HardwareRecord constructor
      // initialize a record
      public HardwareRecord(int number, String tool, int amount, double price)
        setRecordNumber(number);
        setToolName(tool);
        setQuantity(amount);
        setCost(price);
      } // end four-argument HardwareRecord constructor
      // set record number
      public void setRecordNumber(int number)
        recordNumber = number;
      } // end method setRecordNumber
      // get record number
      public int getRecordNumber()
        return recordNumber;
      } // end method getRecordNumber
      // set tool name
      public void setToolName(String tool)
        toolName = tool;
      } // end method setToolName
      // get tool name
      public String getToolName()
        return toolName;
      } // end method getToolName
      // set quantity
      public void setQuantity(int amount)
        quantity = amount;
      } // end method setQuantity
      // get quantity
      public int getQuantity()
        return quantity;
      } // end method getQuantity
      // set cost
      public void setCost(double price)
        cost = price;
      } // end method setCost
      // get cost
      public double getCost()
        return cost;
      } // end method getCost
    } // end class HardwareRecord------------------------------------------------------------------------------------------------
    // Exercise 14.11: RandomAccessHardwareRecord.java
    // Subclass of HardwareRecord for random-access file programs.
    package org.egan; // package for reuse
    import java.io.RandomAccessFile;
    import java.io.IOException;
    public class RandomAccessHardwareRecord extends HardwareRecord
      public static final int SIZE = 72;
      // no-argument constructor calls other constructor with default values
      public RandomAccessHardwareRecord()
        this(0,"",0,0.0);
      } // end no-argument RandomAccessHardwareRecord constructor
      // initialize a RandomAccessHardwareRecord
      public RandomAccessHardwareRecord(int number, String tool, int amount, double price)
        super(number,tool,amount,price);
      } // end four-argument RandomAccessHardwareRecord constructor
      // read a record from a specified RandomAccessFile
      public void read(RandomAccessFile file) throws IOException
        setRecordNumber(file.readInt());
        setToolName(readName(file));
        setQuantity(file.readInt());
        setCost(file.readDouble());
      } // end method read
      // ensure that name is proper length
      private String readName(RandomAccessFile file) throws IOException
        char name[] = new char[15], temp;
        for(int count = 0; count < name.length; count++)
          temp = file.readChar();
          name[count] = temp;
        } // end for
        return new String(name).replace('\0',' ');
      } // end method readName
      // write a record to specified RandomAccessFile
      public void write(RandomAccessFile file) throws IOException
        file.writeInt(getRecordNumber());
        writeName(file, getToolName());
        file.writeInt(getQuantity());
        file.writeDouble(getCost());
      } // end method write
      // write a name to file; maximum of 15 characters
      private void writeName(RandomAccessFile file, String name) throws IOException
        StringBuffer buffer = null;
        if (name != null)
          buffer = new StringBuffer(name);
        else
          buffer = new StringBuffer(15);
        buffer.setLength(15);
        file.writeChars(buffer.toString());
      } // end method writeName
    } // end RandomAccessHardwareRecord------------------------------------------------------------------------------------------------
    // Exercise 14.11: CreateRandomFile.java
    // creates random-access file by writing 100 empty records to disk.
    import java.io.IOException;
    import java.io.RandomAccessFile;
    import org.egan.RandomAccessHardwareRecord;
    public class CreateRandomFile
      private static final int NUMBER_RECORDS = 100;
      // enable user to select file to open
      public void createFile()
        RandomAccessFile file = null;
        try  // open file for reading and writing
          file = new RandomAccessFile("hardware.dat","rw");
          RandomAccessHardwareRecord blankRecord = new RandomAccessHardwareRecord();
          // write 100 blank records
          for (int count = 0; count < NUMBER_RECORDS; count++)
            blankRecord.write(file);
          // display message that file was created
          System.out.println("Created file hardware.dat.");
          System.exit(0);  // terminate program
        } // end try
        catch (IOException ioException)
          System.err.println("Error processing file.");
          System.exit(1);
        } // end catch
        finally
          try
            if (file != null)
              file.close();  // close file
          } // end try
          catch (IOException ioException)
            System.err.println("Error closing file.");
            System.exit(1);
          } // end catch
        } // end finally
      } // end method createFile
    } // end class CreateRandomFile-------------------------------------------------------------------------------------------------
    // Exercise 14.11: CreateRandomFileTest.java
    // Testing class CreateRandomFile
    public class CreateRandomFileTest
       // main method begins program execution
       public static void main( String args[] )
         CreateRandomFile application = new CreateRandomFile();
         application.createFile();
       } // end main
    } // end class CreateRandomFileTest-------------------------------------------------------------------------------------------------
    // Exercise 14.11: WriteRandomFile.java
    import java.io.File;
    import java.io.IOException;
    import java.io.RandomAccessFile;
    import java.util.NoSuchElementException;
    import java.util.Scanner;
    import org.egan.RandomAccessHardwareRecord;
    public class WriteRandomFile
      private RandomAccessFile output;
      private static final int NUMBER_RECORDS = 100;
      // enable user to choose file to open
      public void openFile()
        try // open file
          output = new RandomAccessFile("hardware.dat","rw");
        } // end try
        catch (IOException ioException)
          System.err.println("File does not exist.");
        } // end catch
      } // end method openFile
      // close file and terminate application
      public void closeFile()
        try // close file and exit
          if (output != null)
            output.close();
        } // end try
        catch (IOException ioException)
          System.err.println("Error closing file.");
          System.exit(1);
        } // end catch
      } // end method closeFile
      // add records to file
      public void addRecords()
        // object to be written to file
        RandomAccessHardwareRecord record = new RandomAccessHardwareRecord();
        int recordNumber = 0;
        String toolName;
        int quantity;
        double cost;
        Scanner input = new Scanner(System.in);
        System.out.printf("%s\n%s\n%s\n%s\n\n",
         "To terminate input, type the end-of-file indicator ",
         "when you are prompted to enter input.",
         "On UNIX/Linux/Mac OS X type <ctrl> d then press Enter",
         "On Windows type <ctrl> z then press Enter");
        System.out.printf("%s %s\n%s", "Enter record number (1-100),",
          "tool name, quantity and cost.","? ");
        while (input.hasNext())
          try  // output values to file
            recordNumber = input.nextInt();  // read record number
            toolName = input.next();         // read tool name
            quantity = input.nextInt();      // read quantity
            cost = input.nextDouble();       // read cost
            if (recordNumber > 0 && recordNumber <= NUMBER_RECORDS)
              record.setRecordNumber(recordNumber);
              record.setToolName(toolName);
              record.setQuantity(quantity);
              record.setCost(cost);         
              output.seek((recordNumber - 1) *   // position to proper
               RandomAccessHardwareRecord.SIZE); // location for file
              record.write(output);
            } // end if
            else
              System.out.println("Account must be between 0 and 100.");
          } // end try   
          catch (IOException ioException)
            System.err.println("Error writing to file.");
            return;
          } // end catch
          catch (NoSuchElementException elementException)
            System.err.println("Invalid input. Please try again.");
            input.nextLine();  // discard input so enter can try again
          } // end catch
          System.out.printf("%s %s\n%s","Enter record number (1-100),",
            "tool name, quantity and cost.", "? ");
        } // end while
      } // end method addRecords
    } // end class WriteRandomFile-------------------------------------------------------------------------------------------------
    // Exercise 14.11: WriteRandomFileTest.java
    // Testing class WriteRandomFile
    public class WriteRandomFileTest
       // main method begins program execution
       public static void main( String args[] )
         WriteRandomFile application = new WriteRandomFile();
         application.openFile();
         application.addRecords();
         application.closeFile();
       } // end main
    } // end class WriteRandomFileTest-------------------------------------------------------------------------------------------------
    // Exercise 14.11: ReadRandomFile.java
    import java.io.EOFException;
    import java.io.IOException;
    import java.io.RandomAccessFile;
    import org.egan.RandomAccessHardwareRecord;
    public class ReadRandomFile
      private RandomAccessFile input;
      // enable user to select file to open
      public void openFile()
        try // open file
          input = new RandomAccessFile("hardware.dat","r");
        } // end try
        catch (IOException ioException)
          System.err.println("File does not exist.");
        } // end catch
      } // end method openFile
      // read and display records
      public void readRecords()
        RandomAccessHardwareRecord record = new RandomAccessHardwareRecord();
        System.out.printf("%-10s%-15s%-15s%10s\n","Record","Tool Name","Quantity","Cost");
        try // read a record and display
          while(true)
            do
              record.read(input);
            }while (record.getRecordNumber() == 0);
            // display record contents
            System.out.printf("%-10d%-12s%-12d%10.2f\n", record.getRecordNumber(),
             record.getToolName(), record.getQuantity(), record.getCost());
          } // end while
        } // end try
        catch (EOFException eofException)
          return; // end of file was reached
        } // end catch
        catch (IOException ioException)
          System.err.println("Error reading file.");
          System.exit(1);
        } // end catch
      }  // end method readRecords
      // close file and terminate application
      public void closeFile()
        try // close file and exit
          if (input != null)
            input.close();
        } // end try
        catch (IOException ioException)
          System.err.println("Error closing file.");
          System.exit(1);
        } // end catch
      } // end methode closeFile
    } // end class ReadRandomFile-------------------------------------------------------------------------------------------------
    // Exercise 14.11: ReadRandomFileTest.java
    // Testing class ReadRandomFile
    public class ReadRandomFileTest
       // main method begins program execution
       public static void main( String args[] )
         ReadRandomFile application = new ReadRandomFile();
         application.openFile();
         application.readRecords();
         application.closeFile();
       } // end main
    } // end class ReadRandomFileTest-------------------------------------------------------------------------------------------------
    Below is the sample data to be inputted in the random file:
    Record Tool Name Quantity Cost
    Number
    3 Sander 18 35.99
    19 Hammer 128 10.00
    26 Jigsaw 16 14.25
    39 Mower 10 79.50
    56 Saw 8 89.99
    76 Screwdriver 236 4.99
    81 Sledgehammer 32 19.75
    88 Wrench 65 6.48

    I have managed to fix your program.
    The solution
    The records are sized by the various Writes that occur.
    A record is an int + 15 chars + int + double.
    WriteInt writes 4 bytes
    WriteChar (Called by WriteChars) write 2 bytes
    WriteDouble writes 8 bytes.
    (In Java 1.5 )
    4 bytes + 30 Bytes + 4Bytes + 8 Bytes. = 46 Bytes.
    The details are in the API for Random Acces Files at
    http://java.sun.com/j2se/1.5.0/docs/api/java/io/RandomAccessFile.html
    The code for RandomAccessHardwareRecord line
    public statis final int SIZE = 72needs to have the 72 changed to 46
    This should make your code work.
    I have hacked around with some other bits and will send you my code if you want but that is the key. The asnwers you were getting illustrated a bunch of bytes being read as (say) an int and beacuse of the wrong record length, they were just a bunch of 4 bytes that evaluated to whetever was at that point in the file.
    When the record was written the line
    output.seek((recordNumber -1 ) * RandomAccessHardwareRecord.SIZE);had SIZE as 72 and so the seek operation stuck the file pointer in the wrong place.
    This kind of stuff is good fun and good learning for mentally getting a feel for record filing but in real problems you either serialize your objects or use XML (better) or use jdbc (possibley even better depending on what you are doing).
    I would echo sabre comment about the program being poor though because
    If the program is meant to teach, it is littered with overly complex statements and if it is meant to be a meaningful program, the objects are too tied to hardware and DAO is the way to go. The problem that the program has indicates that maybe it is maybe fairly old and not written with java 2 in mind.
    As for toString() and "Yuk"
    Every class inherits toString() from Object. so if you System.out.println(Any object) then you will get something printed. What gets printed is determined by a complex hieracrchy of classes unless you overRide it with your own method.
    If you use UnitTesting (which would prevent incorrect code getting as far as this code did in having an error), then toString() methods are really very useful.
    Furthermore, IMO Since RandomAccessHardwareRecord knows how to file itself then I hardly think that knowing how to print itself to the console is a capital offence.
    In order to expand on the 72 / 46 byte problem.
    Message was edited by:
    nerak99

  • Serialize tree in random access file

    I have a tree of objects, which are to be serialized. After deserialization,
    each object has to know its children and its parent. Each object need not know its sibling. There are no lateral references. The number of objects in the tree will be around 2000. The depth of tree is 7. Different parts of the tree will be saved and read at different points of time in the application. While the application is running, many of the objects in the tree keep undergoing changes which have to be saved intermittantly.
    I would like to use a random access file. But I have no clue how to serialize a tree of objects in a random access file which will meet the above mentioned requirements.
    I would be thankful if I could get an idea to implement.

    I have a tree of objects, which are to be serialized.
    After deserialization,
    each object has to know its children and its parent.
    Each object need not know its sibling. There are no
    lateral references. The number of objects in the tree
    will be around 2000. The depth of tree is 7.
    Different parts of the tree will be saved and read at
    different points of time in the application. This is an issue. When you Serialize something you serialize the entire object, not a part of it. If you're doing this then you're no longer talking about Serializing a Tree, you're talking about serializing some other thing that represents part of the tree.
    While
    the application is running, many of the objects in
    the tree keep undergoing changes which have to be
    saved intermittantly.
    I would like to use a random access file. But I have
    no clue how to serialize a tree of objects in a
    random access file which will meet the above
    mentioned requirements.
    I would be thankful if I could get an idea to
    implement.If you can come up with a "savable" representation of your tree that allows you to calculate where, in a file, a given part would be then you could use RandomAccessFile to read/write the thing. Just walk through your tree and seek to where you need to go in the file, then read/write the node.
    I hope that made sense
    Lee

  • CSV vhdx files and SAN optimization - sequential or random access or...?

    Is there a best practice on the SAN optimization of LUNs for CSV VHDX files - e.g. sequential vs. random access?
    We recently set up a small two-node Hyper-V 2012 R2 Failover Cluster. As I was creating LUNs for the CSV vhdx files, our SAN (like most, I think) has some pre-set optimization options which are more or less sequential vs. random access. There's now the abstraction
    layer of shared VHDX files and the actual data those VHDXs are being used to store.  Are there any best-practices for SAN optimization in this regard?
    In other words, I could see:
    A. Cluster-shared VHDXs are accessed (more-or-less) based on the type of data they're used for
    B. All cluster-shared VHDXs are (more-or-less) accessed sequentially
    C. All cluster-shared VHDXs are (more-or-less) accessed randomly.
    I have one source that says that for a relatively simple SMB setup like we have that "C" is the recommendation.  I'm curious if anyone else has run into this or seen an official best-practice...?

    Is there a best practice on the SAN optimization of LUNs for CSV VHDX files - e.g. sequential vs. random access?
    We recently set up a small two-node Hyper-V 2012 R2 Failover Cluster. As I was creating LUNs for the CSV vhdx files, our SAN (like most, I think) has some pre-set optimization options which are more or less sequential vs. random access. There's now the abstraction
    layer of shared VHDX files and the actual data those VHDXs are being used to store.  Are there any best-practices for SAN optimization in this regard?
    In other words, I could see:
    A. Cluster-shared VHDXs are accessed (more-or-less) based on the type of data they're used for
    B. All cluster-shared VHDXs are (more-or-less) accessed sequentially
    C. All cluster-shared VHDXs are (more-or-less) accessed randomly.
    I have one source that says that for a relatively simple SMB setup like we have that "C" is the recommendation.  I'm curious if anyone else has run into this or seen an official best-practice...?
    There as good article published recently by Jose Barreto about CSV performance counters. See:
    Cluster Shared Volume: Performance Counters
    http://blogs.msdn.com/b/clustering/archive/2014/06/05/10531462.aspx
    You can run DiskSPD or Intel I/O Meter yourself to see what workload you'll get @ CSV with 10+ VMs doing different I/O types. We did and you'll get
    4-8KB 100% random reads and writes (just make sure you gather statistics for a long time).
    So that's type of workload you could optimize your LUN @ SAN level.
    StarWind Virtual SAN clusters Hyper-V without SAS, Fibre Channel, SMB 3.0 or iSCSI, uses Ethernet to mirror internally mounted SATA disks between hosts.

  • Please a need help, I need my serial njumber, they said is in the coner but not is 0 there.

    I need help, I don't have serial number, so I have a lots of truable to get any the adobe

    please I need help, I tray to call up so many times
    Date: Sun, 27 Apr 2014 02:00:21 -0700
    From: [email protected]
    To: [email protected]
    Subject: please a need help, I need my serial njumber, they said is in the coner but not is 0 there.
        Re: please a need help, I need my serial njumber, they said is in the coner but not is 0 there.
        created by Rajshree in Adobe Creative Cloud - View the full discussion
    Please refer to http://helpx.adobe.com/x-productkb/global/find-serial-number.html
    If you have Creative Cloud then it does not need not serial, you have to just log in to www.creative.adobe.com & download & install from there.
    Regards
    Rajshree
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/6334115#6334115
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/6334115#6334115
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/6334115#6334115. In the Actions box on the right, click the Stop Email Notifications link.
               Start a new discussion in Adobe Creative Cloud at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

Maybe you are looking for

  • Trouble with new SX50HS

    Hi, I am a newbie to photography, but really interested in getting into it.  I thought the SX50HS would be a nice bridge into the hobby, but so far, I am not impressed!  I've ahd the camera for about two weeks.  I just downloaded the pix I have taken

  • Reader rights for adding attachment

    Hi , is it possible to apply reader rights for adding attachments when output pdf form in sap? where can i find more document on controlling reader rights? thanks and best regards. Jun

  • USB / Flash to Video file

    I don't know which forum to post this so I'm just posting it here. I have 2 questions. First one is, how come my hard drive doesn't recognize windows anymore? Second is how do I convert a swf file to a movie file?

  • Do the updates and the Free apps cost us now?

    I am trying to update my applications on ipad and also to download some free apps but the iTunes ask me my credit card information and as my bank service informed me these updates and "free" applications will cost me a lot ! What's going on? Does any

  • Image Sizes for Uploading SAP B1

    I have a customer who has been trying to upload images into the Inventory Master Data of SAP B1, however when uploaded the images appear distorted and stretched. Does anyone happen to know the correct sizes that the images are meant to be, so that th