Passing serialized object and data as byte stream over same stream

I am writing a chat program, I am keeping online user List as Vector A would like to pass online user List to client as Vector object also the client message is sended as byte stream. Is it possible to pass object and data as byte stream over the same stream.

I am writing a chat program, I am keeping online user
List as Vector A would like to pass online user List
to client as Vector object also the client message is
sended as byte stream. Is it possible to pass object
and data as byte stream over the same stream.Why are you sending the client message as a byte stream?
String seems a much more logical type. I would assume that you're reading strings from one client, and printing them on the others. If you translate to bytes in the middle, you're going to have to ensure that you decode those streams correctly on the other side.
And if I were implementing this, I probably wouldn't send the raw Vector or List ... instead, I'd create a Message object, which wraps the Vector/String, and a MessageDispatcher interface, which the client implements to handle incoming messages.

Similar Messages

  • How to pass serialized object and the string through the socket together?

    I have an application which listens on a port and I usually read string lines from it. Now I want to pass serialised object through it , plus I should indicate (using some string like "object coming") tht the following packet is a serialized object.

    Since Strings are serializable you could just send a stream of serialized objects then you don't have to know anything about the format.

  • Data plug-in for binary data with byte streams of variable length

    Hi there,
    I would like to write a data plug-in to read binary data from file and I'm using DIAdem 10.1.
    Each data set in my file consists of binary data with a fixed structure (readable by using direct access channels) and of a byte stream of variable length. The variable length of each byte stream is coded in the fixed data part.
    Can anyone tell me how my data plug-in must look like to read such kind of data files?
    Many thanks in advance!
    Kind regards,
    Stefan

    Hi Brad,
    thank you for the very quick response!
    I forgot to mention, that the data in the byte stream can actually be ignored, it is no data to be evaluated in DIAdem (it is picture data and the picture size varies from data set to data set).
    So basically, of each data set I would like to read the fixed-structure data (which is the first part of the data set) and discard the variable byte stream (last part of the data set).
    Here is a logical (example) layout of my binary data file:
    | fixedSize-Value1 | fixedSize-Value2 | fixedSize-Value3 (=length of byte stream) | XXXXXXXXXXXXX (byte stream)
    | fixedSize-Value1 | fixedSize-Value2 | fixedSize-Value3 (=length of byte stream) | XXXXXX (byte stream)
    | fixedSize-Value1 | fixedSize-Value2 | fixedSize-Value3 (=length of byte stream) | XXXXXXXXXXXXXXXXXXXX (byte stream)
    What I would like to show in DIAdem is only fixedSize-Value1 and fixedSize-Value2.
    ´
    If I understood right, would it be possible to set the BlockLength of each data set by assigning Block.BlockLength = fixedSize-Value3 and to use Direct Access Channels for reading fixedSize-Value1 and fixedSize-Value2 ?
    Thank you!
    Kind regards,
    Stefan

  • Serialized Objects and Servlets

    I'm having a lot of trouble accessing a serialized object and displaying it in a servlet. I get the following exception:
    java.io.StreamCorruptedException: Type code out of range, is -84
    Can anyone help me out here?

    OK... here's some of the code I'm using...
    public Object readObject()
    throws IOException, ClassNotFoundException
              oin = new ObjectInputStream(fin);
              Object obj = oin.readObject();
              oin.close();
              return obj;
    public void writeObject(Object data)
    throws IOException
              oout = new ObjectOutputStream(fout);
              oout.writeObject(data);
              oout.close();
    Essentially, my servlet creates and instance of an ObjectManager class. This ObjectManager then tries to execute the readObject method above.
    The whole process comes to a grinding halt at this point:
    Object obj = oin.readObject();
    I think this problem has to do with the way that I'm trying to access the file to which I have serialized my object. The problem is that I can't think of any other way to do it. Here's how I am currently referencing the file that holds my serialized object:
    File theFile = new File("Serialized.dat");
    FileInputStream fin = new FileInputStream(theFile);
    I've never attempted anything like this before and I suspect I'm way off in my approach. I really appreciate your willingness to help me out.

  • Clone schema with current db objects and data.

    Hi Cloud expert,
    I need feature to clone existing schema and create new schema with schema as a service. I created profile that export schema with database objects and data. I created template that use the profile created. While provisioning the template I found all the database objects with template. Now I need a solution to clone the current schema with all the objects at current time. The way I tried contains all the objects that were exists while exporting the schema. I need the solution to clone schema so that it will contains all the objects and data right now.
    While reading document I found snapclone but that is not the exactly the solution I need. I simply need to clone schema with latest db object and data with Self Service portal.
    Thank You in advance.
    Dilli R. Maharjan

    One option is to run BACKUP/RESTORE, once you have restored you run:
    SELECT 'ALTER TABLE ' + quotename(s.name) + '.' + quotename(o.name) +
           ' DISABLE TRIGGER ALL '
    FROM   sys.schemas s
    JOIN   sys.objects o ON o.schema_id = s.schema_id
    WHERE  o.type = 'U'
      AND  EXISTS (SELECT *
                   FROM   sys.triggers tr
                   WHERE  tr.parent_id = o.object_id)
    Copy result and paste into a query window do to run. Next:
    SELECT 'DELETE ' + quotename(s.name) + '.' + quotename(o.name)
    FROM   sys.schemas s
    JOIN   sys.objects o ON o.schema_id = s.schema_id
    WHERE  o.type = 'U'
    Run this result until you don't get any more errors.
    Run the first query again, but change DISABLE to ENABLE.
    This is more long-winding than scripting, particularly if you have lots of data. But you know that you will not make any changes whatsoever to the schema.
    The scripting in SSMS generally does it right, I believe, but some items are not scripted by default. If you run BACKUP/RESTORE, you know that you get a faithful copy.
    Of course, the best way is to keep your code under version control and take the version control system as your ultimate truth.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • 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

  • DAO pattern Value Objects and Data Streams

    Suppose we have a PersonVO (java bean) with simple attributes i.e. first and last name then the DAO is quite simple and clients of the DAO layer pass VO back and forth (really cleanly).
    But it is a different story if a person has a picture. If the picture is small then we
    could define a field that is simple an array of bytes i.e. byte pic[], and would work ,
    but will not scale if our pic becomes too large or there are lots of persons.
    How can streams be used in this case ? (without dao code leaking into the client layer) and does this break the DAO pattern ?

    I can picture not saving the image bytes themselves
    but a link to a JPG or GIF on the file system.And how would that be guarenteed on a cluster? Or even per OS?
    Putting streams into a database like that can choke
    performance. Can't do WHERE clauses on byte
    streams.For example in PostgreSQL:
    CREATE TABLE images (
      name VARCHAR(32) NOT NULL,
      image bytea NOT NULL,
      imagetype VARCHAR(4),
      CONSTRAINT image_pk PRIMARY KEY (name)
    );After retrieving the image into a byte[] you can either
    - directly serve it to the client (browser) over HTTP through a servlet
    (don't forget to set your content type through HttpServletResponse.setContentType())
    - convert the byte[] to a java.awt.image.BufferedImage using javax.imageio.ImageIO.read(byte[]), and ofcourse do everything you want (including transformations) from there.
    - What ever you can think off.
    Now if you're passing that VO to a JSP, the link to
    the image on the server file system fits nicely into
    the <img> tag and Bob's your uncle.But this will still not be guarenteed to work on a cluster, across platforms, etc.
    10 % 0
    java.lang.ArithmeticException: / by zero;-)

  • Encrytiong serialized object and seald object

    Hello,
    At the moment I'm writing some code using serialized object stream encrytion. But lately I dicovered sth like sealed objects. My question is what is the difference between creating a SealedObject and then writting it to a stream and encrypting the serialized object as a stream?
    1. What is the purpose for SealedObject regarding the possibility of encrypting serialized objects with streams?
    2. Are there any differences in use of those two ways of securing objects?*
    Thanks for Your replies in advance
    DT

    Read it but not shure wht exactly do U mean. It doesn't ansewer mys questions: of what is the reason for usinf sealedobject where we can encrypt the object with the CipherInputStream (which I have posted as question 1 in the 1st post) and what are the differences in idea of use meaning where should we use CipherInputStream and where Seald object?

  • Copying database objects and data from one server database to another server database in AG group

    Hi,
    I am still trying to wrap my head around sql clusters and AGs and I have a project that requires I take a vendor's database and restore it weekly so its available on the production server which is clustered.
    The vendor's database on the cluster is in an AG group and encrypted.
    Right now, I plan to restore the database on a sql staging server and use the SSIS Transfer SQL Server Objects Task to copy the table structure and data from Stage to the Production database of same name and I would first drop the objects in production
    database using the same task.
    I am concerned that this might cause issues with the passive cluster due to "logging" from active to passive. The database is about 260 MBs and I am not sure how many tables.
    Has anyone run into this type of scenario before or have a better solution?
    Thanks
    Sue

    IF I understand anything about clustered sql and logging, the sql server should take the log file and recreate the same scenario on the passive side of the cluster.
    Is that correct?
    Hi Sue,
    Yes, for AlwaysOn Availability Group, the transaction log is basically replayed from the primary to all of the secondary's.
    Besides, from my point of view, as we cannot directly restore a database that is part of an Availability Group, it is a good way using SSIS task to drop and recreate all tables then transfer data from the restored database to the primary replica. Schema changes
    and data changes will also happen on the secondary  replica.
    There are some similar links for your reference.
    http://dba.stackexchange.com/questions/21404/do-schema-changes-break-sql-server-2012-alwayson-or-are-they-handled-transpare
    http://blogs.msdn.com/b/sqlgardner/archive/2012/08/28/sql-2012-alwayson-and-backups-part-3-restore.aspx
    Thanks,
    Lydia Zhang
    If you have any feedback on our support, please click
    here.
    Lydia Zhang
    TechNet Community Support

  • Problem with serialized objects and JWS

    My JWS launched application fails when loading a serialized object that has been instatiated from a class not contained in the signed jar-file. Does anyone know why this happens and if there is some workaround for the problem?

    Where is the class contained then?

  • Search script generator for all objects and data (!) from a user/schema ?

    Is there a way to create a script which (when run) creates all the existing
    TABLES; INDEXES, KEYS and DATA for a specified user/schema ?
    This (PL-)SQL script should contain all INSERTS for the currently existing rows of
    all the TABLEs.
    When I use e.g. export to Dumpfile I have at first find all TABLEs and components
    which I want to dump. This is rather uncomfortable.
    I just want to specify the user name similar to
    createscript user=karl@XE outfile=D:\mydata\myscript.sql
    Is this somehow possible ?

    So that I understand your requirements exactly, are you asking for your script to ...
    1/ export from database A the entire schema of a specified user
    2/ drop all objects owned by that user in database B
    3/ import the objects from database A into database B
    If so, it sounds to me that a shell script that does a schema level export as Nicholas suggested, and then drops the user from database B using the cascade keyword (e.g. drop user username cascade), recreates the user and then imports the export file into B should do the trick.
    I don't think searching for individual tables and creating the statements to recreate them is the best idea.
    Hope that helps
    Graham

  • Best way to port all Windows XP files, applicaitons and data form my PC over to iMac and how to run those Windows apps on Mac?ns on Mac?

    I have a Windows XP machine with apps, files and data.  I want to get all that over to my Mac, and also run those apps under Windows XP or even Windows 7 on my Mac.  Im wondering:
    1.  How best to get those files over to my Mac
    2.  How to run those apps and use my Windows based files/data on my Mac
    3.  How best to run Windows on my Mac....either partitiion my Mac's hard drive and boot up either Windows or MAC OS, or run some other program where I can easily switch back and forth form Windows to MAC OS, or perhaps get it all on an external hard drive, maybe partition that Windows/MAC OS and boot from that?
    Thanks!

    I agree you would benefit by using virtualizaiton software. Virtual Box is one alternative the commercial apps for doing virtualization are Parallels and VMWare Fusion which you also might be interested in for their support and updates.
    Also you may benefit by book marking and using:
    Mac 101 , Switch 101 & Find Out How Video tutorials
    For your MS Office apps then I'd STRONGLY recommend using the native Office For Mac versions, you can find these on Amazon for less than $100 and then you can run the apps natively rather than having to lean on MS Windows. Also for your Financial and Tax software you also may want to use OS X apps too, for example I used Quicken for over 20 years (PC mostly and some Mac) but switched to iBank. Also for tax software I have used Quicken's Turbo Tax, this also runs natively on OS X.
    In other words for your stated needs I don't see much reason to stay with MS Windows. You may have other considerations, if you do please state them, some may be real issues and some may be easily overcome.

  • Can I pass serialized object as argument through WebStart?

    I know I can pass argument through WebStart using <argument> element in the application-desc of the jnlp file.
    Does WebStart support placing a Java serialized string inside the <argument> element? The reason is I want my application to behave differently based on the input object(s).
    So my thinking is first to generate a serialized string form of my object , then place this serialized string inside the <argument> and then when my Application starts, maybe somehow Java deserializes it for me or may be I have to deserializes myself?
    Is this possible?
    Thanks
    -ken

    yes, you can. although I am not sure how long that string can be? what are you going to store in the string - what kind of information?
    I would generally store configuartion parameters in a seperate file. You could pass the path to the config file in your arguments...

  • Business Objects and Data Services on VMWare

    My company has a requirement to deploy Business Objects 4.0 as well as Data Services.
    We are going to be deploying them on Windows Server 2008 R2, hosted on a VMWare cluster.  I have reviewed the PAM, but my question is:
    Will these run using SQL Server 2008 R2 as a database? I see "SQL Server 2008" and I am just curious whether R2 is also supported?
    Thanks.

    Hi,
    SQL Server 2008 R2 is listed in the PAM for DS as Repo DB. For BI4 it is also working and supported. I installed it already on it.
    Regards
    -Seb.

  • MSS Object and data provider Important

    Dear All,
             I have a requirement of changing the list of data that is displaying on the general information of the Manager iview.
    The manager should look the Org unit till depth 3. But we have a standard rule for setting it till org unit 2(MSS_TMV_RULE3).
    So i copied the standard and changed the rule with the depth till 3.  and attached that to the object selection MSS_TMV_EE_ORG1. But it is not working do i need to do some other customizing change in that.
    Please help me to solve this issue.....
    Thanks
    Yogesh

    hi
    if you have made a new view , the new view should be mentioned in the ivew property  in the eportal .
    This should help.
    Regards
    sameer.

Maybe you are looking for

  • How to find an apple store

    i have to send my new ipod nano in for service, and was wondering how i can find out where the nearest store to me is???

  • MacBook Pro versus Monitor Pavilion 23xi

    Hi, Just bought a Pavillion 23xi monitor for my Macbookpro 13inch retina, connected with HDMI to HDMI. First thing can't find a driver software to MAC OS ?  My laptop reconize the monitor but no image on the monitor, having pop ups with speeping mode

  • How can I determine mouse position within a 2D picture control

    I have an application where I'd like the user to be able to interact with objects drawn in a 2D picture control using the mouse.  In order to do this, I need to translate between screen coordinates, which are passed with the mouse events, and coordin

  • Rules Set Issues and Information

    Hi every one, I am running a Rule Set. In Job Console it still shows processing after a while, instead it should be showing completed status, when I expand the rule set in job console to watch the problem it shows that 1 rule is in still processing.

  • Transfer data from cFP to the host

    Hi all, I'm using a Fieldpoint cFP 2120 to take data from temperature sensors. I created the VI to read data and targeted it to the cFP from the project. Since I want to store these data,  I saved them in file in the cFP, but  I want to see them from