Unable to merge two byte arrays

Hi there,
I am trying to merge two byte arrays into one byte array
and write into a new word document using OutputStream object.
But in the new word document that is created only the contents
of the first byte array are being shown and not that of the second one.
I have pasted the code below.
Any pointers will be of great help.
Thanks and Regards,
Partha.
package com.cisco.asit.icn.common.servlets;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
public class TestPOC {
     public static void main(String[] args) {
          try
               System.out.println("I am here...");
               System.out.println("I am in example 4...");
               byte[] byteAr1 = getBytesFromFile(new File("c:\\Testing_POC\\Not_blank.doc"));
               System.out.println(byteAr1.toString());
               System.out.println();
               byte[] byteAr2 = getBytesFromFile(new File("c:\\Testing_POC\\Quest.doc"));
               byte[] finalOne = concatenate(byteAr1, byteAr2);
               System.out.println("byte array 1..."+ byteAr1.length);
               System.out.println("byte array 2..."+ byteAr2.length);
               System.out.println("Final byte array ..."+ finalOne.length);
               InputStream is = new ByteArrayInputStream(finalOne);
               POIFSFileSystem fss = new POIFSFileSystem(is);
               OutputStream out1 = new FileOutputStream("c:\\Testing_POC\\Result.doc");
               fss.writeFilesystem(out1);
               System.out.println("Stored to file system...");
               try {
                    Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL \"" + "c:\\Testing_POC\\Result.doc");
               catch (IOException e1){
                    e1.printStackTrace();
               System.out.println("I am fine till here...");
     out1.flush();
     out1.close();
     catch (Throwable t) {
     t.printStackTrace();
     byte[] res = new byte[l.length + r.length];
     System.arraycopy(l, 0, res, 0, l.length);
     System.arraycopy(r, 0, res, l.length ,r.length);
return res;
     public static byte[] getBytesFromFile(File file) throws IOException {
InputStream is = new FileInputStream(file);
// Get the size of the file
long length = file.length();
// You cannot create an array using a long type.
// It needs to be an int type.
// Before converting to an int type, check
// to ensure that file is not larger than Integer.MAX_VALUE.
if (length > Integer.MAX_VALUE) {
// File is too large
// Create the byte array to hold the data
byte[] bytes = new byte[(int)length];
// Read in the bytes
int offset = 0;
int numRead = 0;
while (offset < bytes.length
&& (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
offset += numRead;
// Close the input stream and return bytes
is.close();
return bytes;
}

parthInfy wrote:
Hi there,
I am trying to merge two byte arrays into one byte array
and write into a new word document using OutputStream object.
But in the new word document that is created only the contents
of the first byte array are being shown and not that of the second one.
Because the end of the first byte array contains a "document ending" tag and anything after that is just flotsam. And, even if you could remove that "document ending" tag, there is for the second a "document begin" tag. (Among many other tags and flags in both documents.) Word (ar just about any) documents are not simple text files to be concatented, truncated, twisted, inverted, or whatever else, at your pleasure. You actually, God forbid, have to kinow what you're doing, to manipulate them at this level. And, surprise, surprise, you don't.
Edit: Google "POI"

Similar Messages

  • Unable to merge two partitions

    I have my Macintosh HD partition, and a bunch of GB of free space, also partitioned. I am unable to merge the two together, there seems to be no drop down arrows to have them combine. Also, I cannot reformat the free space, so all I am left with is 350GB of free space and 350 GB of Macintosh HD. Does anyone know how I could possible merge the two together again?

    If the Macintosh HD partition is above the free space, drag the slider between them as far down as it will go and click Apply.
    If the Macintosh HD partition is below the free space, create a new partition in the free space, clone the contents of Macintosh HD to it, restart from the newly-created partition, delete Macintosh HD, and then proceed as above.
    (116392)

  • Merging two raid arrays together

    Hello,
    I'm not sure if this is posted in the right area. Please move this for advise me where to post if it isn't, thanks!
    I currently have 2 MD1000's connected to my Server2012r2 system and all 30 drives are in one massive Raid 6. I want to reformat and make each MD1000 it's own separate Raid 6 array so that if one crashes, I don't lose all of my data. My question is, if I
    make two separate Raid 6 array's, how do I make it appear as one array/volume in Server2012r2 so I can use it?
    Thanks!

    Hi JasonBlankenship,
    Are you trying to use Windows Storage Space to create this two RAID6 array as high availability? That is not support scenario, may you can ask your hardware vendor for the
    third party redundancy solution.
    • Storage Spaces cannot manage disk drives which are accessed by a controller with RAID capability, even if that RAID capability is ‘turned off’ (set to pass-through mode.)
    • Storage Spaces cannot manage Windows boot volumes.
    More information:
    Storage Technologies Overview
    http://technet.microsoft.com/en-us/library/dn610883.aspx
    I’m glad to be of help to you!
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Unable to merge events in iPhoto

    I am unable to merge two events in iPhoto 9.4.2.  When I select two events to merge and then go to the Event menu there is no "merge" option, not even a greyed out one.  When I try to drag one event on top of the other I can't.  Help menu says either of those approaches would work.  I see similar questions to this on the Discussion Forum, but none seem to resolved.

    Give this basic troubleshooting fix a try: 
    1 - delete the iPhoto preference file, com.apple.iPhoto.plist, that resides in your
         User/Home/Library/ Preferences folder.
    2 - delete iPhoto's cache file, Cache.db, that is located in your
    User/Home/Library/Caches/com.apple.iPhoto folder (Snow Leopard and Earlier).
    or with Mt. Lion from the User/Library/Containers/com.apple.iPhoto/
    Data/Library/Caches/com.apple.iPhoto folder
    3 - launch iPhoto and try again.
    NOTE: If you're moved your library from its default location in your Home/Pictures folder you will have to point iPhoto to its new location when you next open iPhoto by holding down the Option key when launching iPhoto.  You'll also have to reset the iPhoto's various preferences.
    NOTE 2:  In Lion and Mountain Lion the Library folder is now invisible. To make it permanently visible enter the following in the Terminal application window: chflags nohidden ~/Library and hit the Enter button - 10.7: Un-hide the User Library folder.
    OT

  • User defined func: Unavble to merge two arrays in result list

    Hi
    I am trying to merge two arrays on the basis of "FEE" element in the input file;
    Actually there is an Attribute Name and Value pair array coming in the input file which has 5 pairs already(Notification + 100 , oversize + 8 etc.) see example below;
    <m0:Fees>ZB9</m0:Fees>
    <m:Attribute>
      <m0:Attributename>NOTIFICATION</m0:Attributename>
      <m0:Attributevalue>100</m0:Attributevalue>
      </m:Attribute>
    <m:Attribute>
      <m0:Attributename>OVERSIZE</m0:Attributename>
      <m0:Attributevalue>8</m0:Attributevalue>
      </m:Attribute>
    <m:Attribute>
      <m0:Attributename>OVERWEIGHT</m0:Attributename>
      <m0:Attributevalue>108</m0:Attributevalue>
      </m:Attribute>
    <m:Attribute>
      <m0:Attributename>SIGNATURE</m0:Attributename>
      <m0:Attributevalue>294</m0:Attributevalue>
      </m:Attribute>
    <m:Attribute>
      <m0:Attributename>RTS</m0:Attributename>
      <m0:Attributevalue>8</m0:Attributevalue>
      </m:Attribute>
    The condition is:
    CASE 1. If the FEE doesn't exist in the file then only the Atrribute Name and Value in added to the Array
    CASE 2 If FEE exist then add all the Atrribute Name and Value pairs as well as in the last index of Array add String "Fee" in Attributename and String "ZB9" in  Attributevalue.
    CASE 1 is working fine.
    but in CASE 2 even if i m taking an output array of length Attributename +1 and Attributevalue +1 and trying to add "Fee" and "ZB9" respectively, it never happens.
    Please have a look at the code below;
       //write your code here
    public void ud_Attributename(String[] Fees,String[] Attributename,ResultList result,Container container){
              String attribute_copy[]=new String[Attributename.length+1];
              String attribute_name[]=new String[Attributename.length];
              String array_copy1[]=new String[Attributename.length+1];
              //int len =Attributename.length;
              if(Fees[0]!=null)
                   if(Fees[0].equals("ZB0"))
                   Fees[0]="01";
                   else if(Fees[0].equals("ZB5"))
                   Fees[0]="02";
                   else if(Fees[0].equals("ZB6"))
                   Fees[0]="03";
                   else if(Fees[0].equals("ZB9"))
                   Fees[0]="04";
              try{
                   if((Fees[0]=="01")||(Fees[0]=="02")||(Fees[0]=="03")||(Fees[0]=="04"))
                        for(int x=0;x<=Attributename.length;x++)
                             if(x==Attributename.length)
                             array_copy1[x]="Fee";
                             else{
                             array_copy1[x]=Attributename[x];
                             result.addValue(array_copy1[x]);
                   else
                        for(int i=0;i<=len;i++)
                             attribute_name<i>=Attributename[i+1];
                             result.addValue(attribute_name<i>);
              }catch(Exception e)
              {e.printStackTrace();}
    Same way i've used for Attributevalue.
    But the result is
    <ATTRIBUTEPAIR>
    <PAIR>
    <NAME>NOTIFICATION</NAME>
    <VALUE>04</VALUE>
    </PAIR>
    <PAIR>
    <NAME>OVERSIZE</NAME>
    <VALUE>8</VALUE>
    </PAIR>
    <PAIR>
    <NAME>OVERWEIGHT</NAME>
    <VALUE>108</VALUE>
    </PAIR>
    <PAIR>
    <NAME>SIGNATURE</NAME>
    <VALUE>294</VALUE>
    </PAIR>
    <PAIR>
    <NAME>RTS</NAME>
    <VALUE>8</VALUE>
    </PAIR>
    </ATTRIBUTEPAIR>
    Please suggest where i am wrong. ur help is very much appreciated.
    Thnks in advance

    this is i am doing now
       //write your code here
              String attribute_copy[]=new String[Attributename.length+1];
              String attribute_name[]=new String[Attributename.length];
              String attribute_name1[]={"Fee"};
              //String[] Attributename.copyTo(attribute_name1,0);
              //String[] attribute_name1 = (String[]) Attributename.Clone();
              //String fees;
              String array_copy1[]=new String[Attributename.length];
              int len =Attributename.length;
              for(int y=0;y<len;y++){
              array_copy1[y]=Attributename[y];
              if(Fees[0]!=null)
                   if(Fees[0].equals("ZB0"))
                   Fees[0]="01";
                   else if(Fees[0].equals("ZB5"))
                   Fees[0]="02";
                   else if(Fees[0].equals("ZB6"))
                   Fees[0]="03";
                   else if(Fees[0].equals("ZB9"))
                   Fees[0]="04";
                   else if(Fees[0].equals("ZA1"))
                   Fees[0]="05";
                   else if(Fees[0].equals("ZA2"))
                   Fees[0]="06";
              try{
                   if((Fees[0]=="01")||(Fees[0]=="02")||(Fees[0]=="03")||(Fees[0]=="04")||(Fees[0]=="05")||(Fees[0]=="06"))
                        int j=0;
                        for(int a=0;a<=len;a++)
                             if(j==0&&attribute_copy[j]==null)                                   
                                  attribute_copy[j]="Fee";
                             else
                                  //int b=-1;
                                  for(int i=0;i<=len;i++)
                                       if(i==j)
                                       //i=i-1;
                                       attribute_copy[j]=array_copy1[i-1];
                                       break;
                                       else{
                                       continue;}
                        result.addValue(attribute_copy[j]);
                        j+=1;
                   else
                        for(int i=0;i<=len;i++)
                             attribute_name<i>=Attributename[i+1];
                             result.addValue(attribute_name<i>);
              }catch(Exception e)
              {e.printStackTrace();}
    and the result in queue is
    SUPPRESS
    [FEE]
    [NOTIFICATION]
    [NOTIFICATION]
    [OVERSIZE]
    [OVERSIZE]
    [OVERWEIGHT]
    [OVERWEIGHT]
    [SIGNATURE]
    [SIGNATURE]
    [RTS]
    [RTS]
    but in the output i m getting
    <ATTRIBUTEPAIR>
    <REF_HANDLE>0001</REF_HANDLE>
    <PAIR>
    <NAME>Fee</NAME>
    <VALUE>04</VALUE>
    </PAIR>
    <PAIR>
    <NAME>OVERSIZE</NAME>
    <VALUE>8</VALUE>
    </PAIR>
    <PAIR>
    <NAME>OVERWEIGHT</NAME>
    <VALUE>108</VALUE>
    </PAIR>
    <PAIR>
    <NAME>SIGNATURE</NAME>
    <VALUE>294</VALUE>
    </PAIR>
    <PAIR>
    <NAME>RTS</NAME>
    <VALUE>8</VALUE>
    </PAIR>
    </ATTRIBUTEPAIR>
    Notification is missing.

  • Unable 2 read bytes array of images

    I have made a client application which will
    receive an image from server
    the mobile app (clent) is reveiving bytes array in emulator
    but unable 2 receive it in real application...
    message = new byte[2073]; //string 2 read pic;
    for(i=0;i<2073;i++)
    //read pic array byte by byte
    x=is.read(); //(is is an input stream)
    message= (byte)x;
    // also tried this
    //is.read(message)
    works fine in emulator but not in real appication in sony erricson k310i

    sorry actually code was.....
    for reading byte by byte...............
    message = new byte[2073]; //string 2 read pic;
    for(a=0;a<2073;a++)
    //read pic array byte by byte
    x=is.read(); //(is is an input stream)
    message[a]= (byte)x; //problem in last post i[] //converting it into italic
    //for reading whole array message
    // also tried this
    is.read(message)
    and i think there shall be no problem in converting an[b] int into byte

  • Looking for simple algor. for merging two arrays

    Do anyone have a simple algorithm for merging two arrays where both arrays can be null or length=0

    class Merger
         private int[] arr;
         public Merger(int[] pa, int[] pb) {
              arr = new int[pa.length + pb.length];
              for (int x=0; x < pa.length; x++) {
                   arr[x] = pa[x];
              for (int x=0; x < pb.length; x++) {
                   arr[x+pa.length] = pb[x];
         public int[] getArray() {
              return arr;
    public class MergeMaker
         public static void main(String[] args) {
              int[] a = { 1, 2, 3 };
              int[] b = { 7, 8, 9 };
              Merger m = new Merger(a, b);
              int[] c = m.getArray();
              for (int x=0; x < c.length; x++) {
                   System.out.println(c[x]);
    }Mark

  • Assigning value to a two-dimensional byte array - problem or not?

    I am facing a really strange issue.
    I have a 2D byte array of 10 rows and a byte array of some audio bytes:
    byte[][] buf = new byte[10][];
    byte[] a = ~ some bytes read from an audio streamWhen I assign like this:
    for (int i=0; i<10; i++) {
        a = ~read some audio bytes // this method properly returns a byte[]
        buf[i] = a;
    }the assignment is not working!!!
    If I use this:
    for (int i=0; i<10; i++) {
        a = ~read some audio bytes
        for (int j=0; j<a.length; j++) {
            buf[i][j] = a[j];
    }or this:
    for (int i=0; i<10; i++) {
        System.arraycopy(a, 0, buf, 0, a.length);
    }everything works fine, which is really odd!!
    I use this type of value assignment for the first time in byte arrays.
    However, I never had the same problem with integers, where the problem does not appear:int[] a = new int[] {1, 2, 3, 4, 5};
    int[][] b = new int[3][5];
    for (int i=0; i<3; i++) {
    b[i] = a;
    // This works fineAnybody has a clue about what's happening?
    Is it a Java issue or a programmers mistake?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Back again! I'm trying to track down the problem.
    Here is most of my actual code to get a better idea.
    private void test() {
         byte[][] buf1 = new byte[11][];
         byte[][] buf2 = new byte[11][];
         AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(audioFile);
         byte[] audioBytes = new byte[100];
         int serialNumber = 0;
         while (audioInputStream.read(audioBytes) != -1) {
              if (serialNumber == 10) {
                   serialNumber = 0; // breakpoint here for debugging
              // Fill buf1 -- working
              for (int i=0; i<audioBytes.length; i++) {
                   buf1[serialNumber] = audioBytes[i];
              // Fill buf2 -- not working
              buf2[serialNumber] = new byte[audioBytes.length];
              buf2[serialNumber] = audioBytes;
              serialNumber++;
    }I debugged the program, using a debug point after taking 10 "groups" of byte arrays (audioBytes) from the audio file.
    The result (as also indicated later by the audio output) is this:
    At the debug point the values of buf1's elements change in every loop, while buf2's remain unchanged, always having the initial value of audioBytes!
    It's really strange and annoying. These are the debugging results for the  [first|http://eevoskos.googlepages.com/loop1.jpg] ,  [second|http://eevoskos.googlepages.com/loop2.jpg]  and  [third|http://eevoskos.googlepages.com/loop3.jpg]  loop.
    I really can't see any mistake in the code.
    Could it be a Netbeans 6.1 bug or something?
    The problem appears both with jdk 5 or 6.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How do I read directly from file into byte array

    I am reading an image from a file into a BuffertedImage then writing it out again into an array of bytes which I store and use later on in the program. Currently Im doing this in two stages is there a way to do it it one go to speed things up.
    try
                //Read File Contents into a Buffered Image
                /** BUG 4705399: There was a problem with some jpegs taking ages to load turns out to be
                 * (at least partially) a problem with non-standard colour models, which is why we set the
                 * destination colour model. The side effect should be standard colour model in subsequent reading.
                BufferedImage bi = null;
                ImageReader ir = null;
                ImageInputStream stream =  ImageIO.createImageInputStream(new File(path));
                final Iterator i = ImageIO.getImageReaders(stream);
                if (i.hasNext())
                    ir = (ImageReader) i.next();
                    ir.setInput(stream);
                    ImageReadParam param = ir.getDefaultReadParam();
                    ImageTypeSpecifier typeToUse = null;
                    for (Iterator i2 = ir.getImageTypes(0); i2.hasNext();)
                        ImageTypeSpecifier type = (ImageTypeSpecifier) i2.next();
                        if (type.getColorModel().getColorSpace().isCS_sRGB())
                            typeToUse = type;
                    if (typeToUse != null)
                        param.setDestinationType(typeToUse);
                    bi = ir.read(0, param);
                    //ir.dispose(); seem to reference this in write
                    //stream.close();
                //Write Buffered Image to Byte ArrayOutput Stream
                if (bi != null)
                    //Convert to byte array
                    final ByteArrayOutputStream output = new ByteArrayOutputStream();
                    //Try and find corresponding writer for reader but if not possible
                    //we use JPG (which is always installed) instead.
                    final ImageWriter iw = ImageIO.getImageWriter(ir);
                    if (iw != null)
                        if (ImageIO.write(bi, ir.getFormatName(), new DataOutputStream(output)) == false)
                            MainWindow.logger.warning("Unable to Write Image");
                    else
                        if (ImageIO.write(bi, "JPG", new DataOutputStream(output)) == false)
                            MainWindow.logger.warning("Warning Unable to Write Image as JPEG");
                    //Add to image list
                    final byte[] imageData = output.toByteArray();
                    Images.addImage(imageData);
                  

    If you don't need to manipulate the image in any way I would suggest you just read the image file directly into a byte array (without ImageReader) and then create the BufferedImage from that byte array.

  • Merging elements of array

    Hi,
    I am new to programming.
    I have a sensor that sends a data stream through a serial port. I have collect all that data in a 1D unsigned byte array. Now, lets say my 1-D array is [12][45][65][12]...... where each "[ ]"  is a element of the array. Now to make sense of this data what i need to do is merge two elements the array and multipy it by 2/(2^15). i.e. My converted data should by [1245]*2/(2^15). Basically 2 bytes together makes sense. I can do a simple add of each element. Also the other problem is,data from the sensor is a stored as the 1-D array  of unsigned byte. However, the converted data is supposed to be signed 16-bit integer.
    Please give any suggestions on how to go about doing this.
    Siddhant Shah

    Another option is "decimate&Join". (Here it is easy to change the byte order if needed).
    Message Edited by altenbach on 12-15-2008 06:28 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    8bitTo16BitByteOrder.png ‏5 KB

  • How to add 16 bit message sequential number to the byte array

    hi
    iam trying to implement socket programming over UDP. Iam writing for the server side now.I need to send an image file from server to a client via a gateway so basically ive to do hand-shaking with the gateway first and then ive to send image data in a sequence of small messages with a payload of 1 KB.The data message should also include a header of 16 bit sequential number and a bit to indicate end of file.
    Iam able to complete registration process(Iam not sure yet).I dnt know how to include sequential number and a bit to indicate end of file.
    I would like to have your valuable ideas about how to proceed further
    package udp;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class Sender  {
        protected BufferedReader in = null;
        protected FileInputStream image=null;
        protected static boolean end_of_file=true;
    /** pass arguments hostname,port,filename
    * @param args
    * @throws IOException
       public static void main(String[] args) throws IOException{
            DatagramSocket socket = new DatagramSocket(Integer.parseInt(args[1]));
            boolean more_messages = true;
              String str1=null;
                * gateway registration
                try{
                     //send string to emulator
                    String str="%%%GatewayRegistration SENDER test delay 10 drop 0 dupl 0 bandwidth 1000000";
                    byte[] buff=str.getBytes();
                    InetAddress emulator_address = InetAddress.getByName(args[0]);
                    DatagramPacket packet = new DatagramPacket(buff, buff.length,emulator_address,Integer.parseInt(args[0]));
                    socket.send(packet);
                        // figure out response
                    byte[] buf = new byte[1024];
                    DatagramPacket recpack=new DatagramPacket(buf,buf.length);
                    socket.receive(recpack);
                   // socket.setSoTimeout(10000);
                    String str2=str1.valueOf(new String(recpack.getData()));
                    if(socket.equals(null))
                         System.out.println("no acknowledgement from the emulator");
                        socket.close();
                    else if(str2=="%%%GatewayConfirmation")
                    //     String str1=null;
                         System.out.println("rec message"+str2);
                    else
                         System.out.println("not a valid message from emulator");
                         socket.close();
                catch (IOException e) {
                    e.printStackTrace();
                      end_of_file = false;
         /**create a packet with a payload of 1     KB and header of 16 bit sequential number and a bit to indicate end of file
      while(end_of_file!=false)
          String ack="y";
          String seqnum=
           File file = new File(args[2]);                               
                    InputStream is = new FileInputStream(file);                 
            socket.close();
      private byte[] byteArray(InputStream in) throws IOException {
             byte[] readBytes = new byte[1024]; // make a byte array with a length equal to the number of bytes in the stream
          try{
             in.read(readBytes);  // dump all the bytes in the stream into the array
            catch(IOException e)
                 e.printStackTrace();
            return readBytes;
      

    HI Rolf.k.
    Thank you for the small program it was helpfull.
    You got right about that proberly there  will be conflict with some spurios data, I can already detect that when writing the data to a spreadsheet file.
    I writes the data in such a way, that in each line there will be a date, a timestamp, a tab and a timestamp at the end. That means two columns.
    When i set given samplerate up, that controls the rate of the data outflow from the device, (1,56 Hz - 200 Hz),   the data file that i write to , looks unorderet.
     i get more than one timestamp and severel datavalues in every line and so on down the spreadsheet file.
    Now the question is: Could it be that the function that writes the data to the file,  can't handle the speed of the dataflow in such a way that the time stamp cant follow with the data flowspeed. so i'm trying to set the timestamp to be  with fractions of the seconds by adding the unit (<digit>) in the timestamp icon but its not working. Meaby when i take the fractions off a second within the timestamp i can get every timestamp with its right data value. Am i in deeb water or what do You mean!??
    AAttached Pics part of program and a logfile over data written to file
    regards
    Zamzam
    HFZ
    Attachments:
    DataFlowWR.JPG ‏159 KB
    Datalogfile.JPG ‏386 KB

  • How do i covert an image in J2ME into an byte array ?

    Can anyone help to show me the way to convert an image into a byte array ?
    Thanks early reply appreciated.

    Hi! I�m developing an application to be installed in two devices. My problem is that i want to send an image: I can receive it with createImage(InputStream ip), but how can i send it with OutputStream? it needs a byte array (method write), how can i convert an image into a byte array?is there any other solution? like send it as a string...
    Thanks

  • Problem in reading/writing byte array in Access database! PLEASE HELP!!

    Hi,
    I want to store a signature, which is in form of a byte array, in OLE Object field in MS Access database. I want then to retrieve this signature and verify it. The problem is that the retrieved byte array is not identical to the stored (original) one, and therefore, verifying the signature fails! Any help would be much appreciated as I can't proceed in my project without solving this problem. Here is the code to do the above mentioned functionality:
    //This part stores the signature (VT) in the table TTPTrans
    try
    { con = connect();
    ps = con.prepareStatement("UPDATE TTPTrans SET VT = ?, SigVT = ? WHERE TransID = ?");
    ps.setBinaryStream(1, new ByteArrayInputStream(vt), vt.length);
    ps.setBinaryStream(2, new ByteArrayInputStream(sigvt), sigvt.length);
    ps.setString(3, tID);
    ps.executeUpdate();
    ps.close();
    con.close();
    catch (Exception e)
    {  System.err.println(e.getMessage());
    e.printStackTrace();
    //This part retrive the signature from the table in the byte array o1:
    ResultSet result;
    byte[] o1 = null;
    byte[] o2 = null;
    try
    { con = connect();
    Statement statement = con.createStatement();
    result = statement.executeQuery("SELECT VT, SigVT" +
    " FROM TTPTrans" +
    " WHERE TransID = " + "'" +
    transID + "'");
    while (result.next()) {
    o1 = result.getBytes("VT");
    o2 = result.getBytes("SigVT");
    statement.close();
    con.close();
    catch(Exception e)
    { System.err.println(e.getMessage());
    e.printStackTrace();
    }

    In the following code, I use a ASN1SDSSSignature class, which is a subclass that I created from the Siganture class, to create and verify an SDSS signature. The ASN1SDSSSignature has two ASN1Integer class variables:
    signcryption = token.getSigncryption();
    sig.initVerify(ttpCert);
    sig.update(receivedVT);
    boolean verified = sig.verify(receivedSigVT);
    if(!verified)
    System.err.println("TTP signatire on received token invalid. ");
    notify()
    return;
    Where receivedVT and receivedSigVT are the byte arrays retrieved from th database. The following exception is thrown when I run the application:
    ASN1 type mismatch!
    Expected: codec.asn1.ASN1Integer
    In: ASN1SDSSSignature
    At index 0
    Got tag: 4 and Class: 0
    I hope this would clarify the situation and thanks in advance for any comments you may post.

  • Display byte array image or ole object in Section through dynamic code?

    To Start I am a Complete Newbe to Crystal Reports. I have taken over a project originally written in VS2003 asp.net using SQL Server 2005 and older version of Crytal Reports. I have moved project to VS2010 and Cryatal Reports 10 still using SQL Server 2005. Have multiple reports (14 to be exact) that display data currently being pulled from database suing a dataset, each report has from 4 to 14 Sections. I have modified database table with two new fields. Field1 contains string data with full path to a scanned document (pdf or jpeg). Field2 holds a byte array of the actual image of the scanned document. I have tested the database and it does infact contain the byte array and can display the image via VB.net code. I can make the report display the scanned image using ole object.
    Now my real question: I need to add a new Section and it should display either the byte array of the scanned image or the actual scanned image (pdf or jpeg) . How can I have it do either of these options via code dynamicly while application is running?

    First; only CRVS2010 is supported on VS2010. You can download CRVS2010 from here;
    SAP Crystal Reports, developer version for Microsoft Visual Studio: Updates & Runtime Downloads
    Developer Help files are here:
    Report Application Server .NET API Guide http://help.sap.com/businessobject/product_guides/sapCRVS2010/en/xi4_rassdk_net_api_en.zip
    Report Application Server .NET SDK Developer Guide http://help.sap.com/businessobject/product_guides/sapCRVS2010/en/xi4_rassdk_net_dg_en.zip
    SAP Crystal Reports .NET API Guide http://help.sap.com/businessobject/product_guides/sapCRVS2010/en/crnet_api_2010_en.zip
    SAP Crystal Reports .NET SDK Developer Guide http://help.sap.com/businessobject/product_guides/sapCRVS2010/en/crnet_dg_2010_en.zip
    To add the images, you have a number of options re. how to. You even have two SDKs that y ou can use (RAS and CR).
    Perhaps the best place to start is with KB [1296803 - How to add an image to a report using the Crystal Reports .NET InProc RAS SDK|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233393336333833303333%7D.do]. The KB describes how to add images to a report using the InProc RAS SDK, but also references other KBs that use CR SDK.
    Also, don't forget to use the search box in the top right corner of this web page.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

  • How to chnage number of bits in every packet of a byte array

    Hi I have an array of byte array of 1 and 0s. I would like to make sure every pack of 1 or 0s contains 8 number
    I can use this example to explain it better. Lets say I have this array
    111111110000000111111100000000
    As can be first pack of 0s and the second pack of 1s contain 7 bits. I would like to programaticaaly change it to 8 so the result should be
    11111111000000001111111100000000 
    As can be seen now evey pack of 1s or 0s contains 8 element . Could you please help me on this.A sample code would be great
    Many thanks

    Reshape array is your friend.Nevermind.  I just realized what you were going for.  Will need to rethink...
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    8x bits long.png ‏21 KB

Maybe you are looking for

  • Lync 2013 updating databases after updating Front End servers

    We have a front-end server pool consisting of 3 Lync 2013 servers and a back end of 2 SQL servers using SQL mirroring.  All servers are Windows 2008 R2. Following the instructions in http://support2.microsoft.com/kb/2809243 , I verified that the serv

  • N97 Problem

    hey guys I'm not sure if this is common, but my n97 is running software version 20.2.019. I bought just recently and it was working fine for the first 2 months. Then i started having problems, like the usual resets and lags.  Lately my phone has been

  • Symbol next to battery

    What symbol on screen top next to battery that looks like a house or old phone ? I' can't find the Celular data even thought I did the network reset! I appreciate some info !

  • My iPhone 4S is not preforming any network related operations after 5.0.1 update - please help!

    My iPhone 4S is not preforming any network related (Calls, Messages) operations after 5.0.1 update - please help!

  • IMovie 10.0.2 Scrolling titles alignment

    Hi Am I going mad? I cannot find how to centre align text in the scrolling titles. I stupidly started a project in new iMovie 10.0.2 OS X Mavericks 10.9.1 & didn't properly check out the new program before I loaded all my movie clips & photos - I rea