/** {@inheritDoc} */ public void writeChars(final String str) throws IOException { oos.writeChars(str); }
/** {@inheritDoc} */ @Override public void writeChars(@NotNull String s) throws IOException { oos.writeChars(s); }
/** {@inheritDoc} */ @Override public void writeChars(@NotNull String s) throws IOException { oos.writeChars(s); }
/** * JDK serialization hook for serializing * * @param oos The stream to write ourselves to * * @throws IOException Indicates an IO exception accessing the given stream */ public void serialize(ObjectOutputStream oos) throws IOException { log.tracef( "Starting serialization of [%s] EntityEntry entries", count ); oos.writeInt( count ); if ( count == 0 ) { return; } ManagedEntity managedEntity = head; while ( managedEntity != null ) { // so we know whether or not to build a ManagedEntityImpl on deserialize oos.writeBoolean( managedEntity == managedEntity.$$_hibernate_getEntityInstance() ); oos.writeObject( managedEntity.$$_hibernate_getEntityInstance() ); // we need to know which implementation of EntityEntry is being serialized oos.writeInt( managedEntity.$$_hibernate_getEntityEntry().getClass().getName().length() ); oos.writeChars( managedEntity.$$_hibernate_getEntityEntry().getClass().getName() ); managedEntity.$$_hibernate_getEntityEntry().serialize( oos ); managedEntity = managedEntity.$$_hibernate_getNextManagedEntity(); } }
/** {@inheritDoc} */ public void writeChars(final String str) throws IOException { oos.writeChars(str); }
/** {@inheritDoc} */ public void writeChars(final String str) throws IOException { oos.writeChars(str); }
/** {@inheritDoc} */ public void writeChars(final String str) throws IOException { oos.writeChars(str); }
@Override public void writeChars(String s) throws IOException { this.raw.writeChars(s); }
/** {@inheritDoc} */ public void writeChars(final String str) throws IOException { oos.writeChars(str); }
/** {@inheritDoc} */ public void writeChars(final String str) throws IOException { oos.writeChars(str); }
/** {@inheritDoc} */ @Override public void writeChars(@NotNull String s) throws IOException { oos.writeChars(s); }
@Override public void writeChars(String str) throws IOException { super.writeChars(str); super.flush(); }
/** {@inheritDoc} */ @Override public void writeChars(@NotNull String s) throws IOException { oos.writeChars(s); }
private void writeObject(ObjectOutputStream os){ try{ os.defaultWriteObject(); os.writeChars(spe.encryptPassword("your password")); } catch (Exception e){ e.printStackTrace(); } }
FileOutputStream fos = null; ObjectOutputStream os = null; try { fos = new FileOutputStream(YOUR_FILE_NAME); os = new ObjectOutputStream(fos); for(YourObjectType current : YourQueue){ os.writeXXX(current); //Where XXX is the appropriate write method depending on your data type os.writeChars(","); //Since you mentioned wanting a comma delimiter.. } } catch(IOException e){ e.printStackTrace(); } finally { if(fos != null) fos.close(); if(os != null) os.close(); }
// writing FileOutputStream outFile = new FileOutputStream("C:"+File.separatorChar+"transactions.dat"); ObjectOutputStream out = new ObjectOutputStream(outFile); String s = brokerageAcc1.toString(); out.writeInt(s.length()); System.out.println(s.length()); out.writeChars(s); // reading FileInputStream inFile = new FileInputStream("C:"+File.separatorChar+"transactions.dat"); ObjectInputStream in = new ObjectInputStream(inFile); int length = in.readInt(); // get the number of chars System.out.println(""+length); StringBuilder result = new StringBuilder(); for (int i = 0; i < length; i++) result.append(in.readChar()); System.out.println(result.toString());
/** * JDK serialization hook for serializing * * @param oos The stream to write ourselves to * * @throws IOException Indicates an IO exception accessing the given stream */ public void serialize(ObjectOutputStream oos) throws IOException { log.tracef( "Starting serialization of [%s] EntityEntry entries", count ); oos.writeInt( count ); if ( count == 0 ) { return; } ManagedEntity managedEntity = head; while ( managedEntity != null ) { // so we know whether or not to build a ManagedEntityImpl on deserialize oos.writeBoolean( managedEntity == managedEntity.$$_hibernate_getEntityInstance() ); oos.writeObject( managedEntity.$$_hibernate_getEntityInstance() ); // we need to know which implementation of EntityEntry is being serialized oos.writeInt( managedEntity.$$_hibernate_getEntityEntry().getClass().getName().length() ); oos.writeChars( managedEntity.$$_hibernate_getEntityEntry().getClass().getName() ); managedEntity.$$_hibernate_getEntityEntry().serialize( oos ); managedEntity = managedEntity.$$_hibernate_getNextManagedEntity(); } }