Read binary file 10 bytes at a time

I want to read binary file in a specific format. There is a number at the starting of the file. That tells us where the data is starting. Suppose it says 3975, then it mean data starts at 3975. Then once I read that location I want to read data at 10bytes at a time and then convert it to numeric and display it on graph. I am attaching the file format and the current vi which I am using. please help.
Solved!
Go to Solution.
Attachments:
topo.zip ‏89 KB

Ah, the first 10 characters are a string!
After opening the file, use the Read From Text File with count set to 10.  Then use the Decimal String to Number to convert this string into your "record size".
NOTE:  The text indicator was just for debug purposes.  You don't really need it.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Attachments:
Read record size.png ‏12 KB

Similar Messages

  • Reading binary files

    Hi
    I need some help in reading binary files. This is the code I have so far.
    import java.io.InputStream;
    import java.io.FileInputStream;
    import java.io.IOException;
    public class patternmatch {
         public static void main (String[] args) {   
              final byte[] bytes = new byte[1];
              try {     
                   final InputStream  instream = new FileInputStream  (args[0]);
                   while (true) {
                        final int count = instream.read (bytes);
                        if (count==-1) break;
                        System.out.println(bytes);
                   instream.close();       
              } catch (IOException e) {
                   System.err.println(e);         
    }Instead of a list of hexadecimal numbers that I want I get a long line of
    [B@eee36c
    [B@eee36c
    [B@eee36c
    [B@eee36c
    Which represents some address I think.
    Does anyone know how to extract the hexidecimal numbers?
    Thanks
    Charles

    double post http://forum.java.sun.com/thread.jsp?forum=31&thread=558802

  • Read Binary File, Help me! Thanks!

    I want to read a binary file and tried several times,
    but failed, who can give me an example?
    Thank you !

    Thank you very much! my codes are listed below
    i want to read a binary file and convert to ASCII.
    import java.io.*;
    public class FileInputDemo
    public static void main(String args[])
    if (args.length == 1)
    try
    FileInputStream fstream = new FileInputStream(args[0]);
    DataInputStream in = new DataInputStream(fstream);
    while (in.available() != 0)
    System.out.println(in.readLine());
    in.close();
    }catch (Exception e)
    {System.err.println("File input error");}
    else
    {System.out.println("Invalid parameters");}
    }

  • How to open and read binary files?

    How do I open and read Binary files?

    Did you  look on The Unarchiver's web site where it has a link to older versions? http://theunarchiver.googlecode.com/files/TheUnarchiver3.2_legacy.zip
    The best thing to do is ask your friends what programs they used to produce these files, or at least what format files they are producing.  Otherwise it's like being shown a car and given a bundle of 200 keys with no idea to which one to use, or even if any of them work with that car.
    Using The Unarchiver will likely not do anything because it too will not know what format files are involved, and they may not even been in an archived format.  If they sent you a Word file without telling you (a favorite of Windows users to do  -- it drives me crazy when they could have just sent them in plain text), The Unarchiver won't open them.  If it's a picture file then using Hexedit will just show you a bunch of unintelligible stuff as shown in an earlier post, though you may see a line of text providing a hint.
    As I said earlier, often .bin may be an executable program which needs another program to actually interpret it.  That's what Java is trying to do.  Still, it may think it can execute the file, but it is highly unlikely somebody would send you an executable program (and if they did I would not trust it).  For all you know it may be a Windows virus.

  • Read a file at a fixed time of day using PS in OSB

    I have a proxy service which read a file, now I want to read that file at a fixed time in a day(suppose 12pm every day).
    How do I make the JCA file/proxy configuration?
    Pls suggest!

    Re: How to implement in OSB: Scheduling, Timers and Custom properties
    Regards,
    Anuj

  • Labview 8.2 Read Binary File, no pos offset option anymore?!

    I have a VI that worked perfectly well in 7.1 and now I've opened it in 8.2 it doesn't work and I can't revert back to 7.1 because I accidently pressed save.
    In 7.1 I used the combination of open, read and close file functions to read parts of a large binary data file - I cannot read the whole file into Labview 8.2 as it fills the memory. There isn't a terminal in the 'read binary file' function in 8.2 for 'pos offset' which is what I used to use in 7.1. How am I supposed to open the file now? Surely they have not removed such a useful facility entirely - is there another way to do it that I am not aware of?
    Many thanks in advance for help,
    Sarah

    smercurio_fc wrote:
    André, at first I could not understand your response, ...
    Must be my Dutch way of writing English
    Regards,
    André
    Using whatever version of LV the customer requires. (LV5.1-LV2012) (www.carya.nl)

  • Read binary file in LabVIEW 2012

    Hi,
    Have anyoune experienced problems reading binary files in 2012 previously saved in 2010.
    As shown on attached image, the same VI is opened in 2010 and 2012 reading the same binary file containing the data structure "ProcessList IN".
    I suspect it has something to do with the variants ?
    The error message does help a lot (-;
    Any ideas ?
    Kind regards
    Kahr
    Regards Kahr
    Certified LabVIEW Architect
    CIM A/S
    Attachments:
    Read_Binary_File_Error_LV2012.png ‏426 KB

    Hi Kahr,
    "error 1" tells one of the input parameters is wrong: it's either the path or the cluster datatype! The error message only mentions a file path AS AN EXAMPLE!
    You're using BinaryRead similar to those old Datalog file functions to read a cluster of several data. It has been know that datalog files get tricky when one is using a different LabVIEW version to read them due to changes of internal data representation. Maybe that's the point that hits you now?
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How to read binary files wrt specific BYTE size and length??

    Hello Everyone,
                                I have a project I want to accomplish. I have a binary file, and I would like to read the data and print on wfm in a specific order and size.
    The data is 16 bit binary type , and needs to be read in chunks of 2 bytes.
    i have 30 bytes of sample 1.
    followed by 2 bytes of sample 2.
    followed by another 2 bytes of sample 3.
    steps 2-4 should be repeated 10 times and then i should read sample 4 which is of 2 bytes.....
    How should I do it?? I don't have any VI build... all i have is the example VI...
    can anyone pleasehelp me???
    Now on LabVIEW 10.0 on Win7

    smercurio_fc, sorry for the confusion, i will try my best to explain...
    1. No, i don;t have to read the file again, once it has read, I used
    while loop just to see the data updating (i press run, and before i can
    visualize i have the waveforms; i can get rid of the while loop)
    2. I have 30 different values of 1 sample. actually, the data is cmg
    from tri-axial accelerometer; each axis is of 10 bytes(hence 3*10 =
    30bytes)
    3. I am repeating the steps 2-4 10 times because the data was written
    into the binary file after 10 times sampling the sensors(if first 3
    samples are read @ 1000hz, sample 4 was read at 1000/10 = 100hz)
    4. I am using the graphs to interpret the values, that's it. The
    values are already scaled when they were wrote to the binary file, I
    have to simply interpret it.
    I have made some changes in the VI, now i am reading only the first
    30bytes, that too, in chunks of 10-10-10 bytes, and plotting the 3
    samples simultaneously on a waveform chart. (will approach 1
    sensor/sample at a time) and running the loop for 10 times. I have changed I8 to I16 now.
    Please let me know if it makes sense to you now.
    P.S. each sample is a sensor data.
    Now on LabVIEW 10.0 on Win7
    Attachments:
    data_read.vi ‏24 KB

  • Reading a binary file (byte swapping?): HELP!

    Hi,
    Below are 2 simple programs, one in C and the other in Java that read a binary file. The first 3 integer numbers read by the C program are:
    910, 1024437292, 100002
    The first 3 integer numbers read by the Java program are:
    -1912406016, 749473597, -1568276224
    The file was written with another C program. The values read by the C program listed here are correct.
    I supect that I have a byte swapping problem. Do you know how I can solve this problem? I really can't change the format of the input file.
    Thanks for your help,
    Miguel
    #include <stdio.h>
    void main(int argc, char *argv[]) {
    long buff[600];
    FILE *fp = fopen("c:\\inetpub\\wwwroot\\super\\wvdot3.awg","r");
    fread(buff,sizeof(int),512,fp);
    int sz = sizeof(int);
    import java.io.*;
    public class test {
    public static void main(String[] args) {
    try {
    DataInputStream din = new DataInputStream(new BufferedInputStream
    (new FileInputStream("c:\\inetpub\\wwwroot\\super\\wvdot3.awg")));
    int nrecs = din.readInt();
    int version = din.readInt();
    int routetype = din.readInt();
    System.out.println("read: " + nrecs + " " + version + " " + routetype);
    } catch (IOException exc) {
    System.out.println("IOException: " + exc);

    Yeah, the problem is byte ordering. I had to deal with the same thing, since Java is always big endian, and intel and DEC Alpha are both little endian. I assume you're original program runs on Intel.
    I ended up creating a new LittleEndianDataInputStream. Unfortunately, you can't just extend DataInputStream since all it's methods are final. You can however copy the source, rename it, and then change all the multi-byte numeric methods to reverse the byte ordering.
    For example, here is the code for the original and little endian version of readInt()
    <code>
    // DataInputStream
    public final int readInt() throws IOException {
    InputStream in = this.in;
    int ch1 = in.read();
    int ch2 = in.read();
    int ch3 = in.read();
    int ch4 = in.read();
    if ((ch1 | ch2 | ch3 | ch4) < 0)
    throw new EOFException();
    return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0));
    // LittleEndianDataInputStream
    public int readInt() throws IOException
    int ch1 = in.read();
    int ch2 = in.read();
    int ch3 = in.read();
    int ch4 = in.read();
    if ((ch1 | ch2 | ch3 | ch4) < 0)
    throw new EOFException();
    // here's the change
    return ( (ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0) );
    </code>

  • Problem rendering certain bytes when reading binary file

    I have a two part problem. I am trying to read files of any type from a client and transfer them over a pipe to a UNIX host running a C API. I have this process working for text data just fine however when I try and submit binary data there appears to be some data loss. Most of the file appears to end up on the host but it just isn't as long as the source, nor will it render correctly.
    In investigating this problem I tried to simply output a temporary copy of the transferred file on the client as I was reading the file just to see if my "thinking/process" was correct. The copy of the file ends up the same length but some bytes seem to have been misread. Upon doing a windiff on the source and copy it appears that several characters that are rendered as blocks in the original show up as '?' in the destination file.
    I believe this is an entirely different problem than why I am losing data on the host side but I want to first figure out why this problem is occuring. The below code is how I am reading and writing the binary file. I realize it has some problems with it, it is more of a POC at this point.
               final int BUF_SIZE = 1000;  // 1K
               char[] cBuffer = new char[BUF_SIZE];
               byte[] bBuffer = new byte[BUF_SIZE];
               int read = BUF_SIZE;
               long length = fLocalFile.length();
               FileInputStream fis = new FileInputStream(fLocalFile);
               DataInputStream dis = new DataInputStream(fis);
               FileOutputStream fos = new FileOutputStream("C:\\temp.file", false);
               DataOutputStream dos = new DataOutputStream(fos);
               for (int start = 0; start < length && reply.getSuccess(); start += read)
                   System.out.println("length: " + length + " start: " + start);
                   read = dis.read(bBuffer, 0, BUF_SIZE);
                   // Send the file data
                   String sTemp = sDestName + ":" + new String(bBuffer,0,read);
                   dos.write(bBuffer,0,read);
                   reply = axBridge.execute (Commands.CMD_FILE_TRANSFER_SEND, sTemp);
                dos.close();
            }It seems as if when reading or writing on the data streams some of the characters aren't getting converted correctly. Can anyone help? I've been testing with a PDF if that sheds any light.

    Yes but you ARE converting to a String first which you then send to the axBridge (sTemp!). Try just sending the bytes. You can easily pre-pend the "<filename>:" by sending those first.
    I know that some conversions occur when converting to a String, what they are exactly and what the exact effects are escapes me. Past experience though has taught me to ALWAYS send bytes, with no conversions, what you read is what you send.
    You may need to modify the send/receive protocol so that you send the command first with the filename then the bytes are sent after...
    As for why the file is not being written correctly to: c:\\temp.file, don't know... try the following code, it tends to be one of the "standard" ways of "streaming" data...
         byte buf[] = new byte[bufSize];
         int bRead = -1;
         while ((bRead = in.read (buf)) != -1)
             out.write (buf,
                     0,
                     bRead);
         }     And try just using a FileOutputStream or wrapping in a BufferedOutputStream.

  • Write-read binary file Error 116

    Hi all,
    I am saving double, numeric array data into a binary file and then trying to read it back but keep on getting Error 116 (cannot read from binary file).
    I have attached screenshots of the way I am writing my data into the binary file and then the way I am trying to read it. Basically my data is chunks of 2D double arrays, coming at a rate of 1hz and this is why I have to use the get and set file size functions prior to saving into the file (i.e. so that each time I can append my file with new data).
    I have tried all combinations for the write to binary and read to binary file functions, thus meaning I have tried little, big and native endian options but I keep getting the same error. Also played with the way I append my data, i.e. I have used both the "offset in bytes" and "end of file" options, just in case this made any difference, but again no luck.
    Any help would be much much appreciated.
    Regards,
    Harry
    Solved!
    Go to Solution.
    Attachments:
    Write_Bin.JPG ‏154 KB
    Read_Bin.JPG ‏100 KB

    Just as an amendment to my original post, I can succesfully read my data in MATLAB using the standard fread function with double precision. I presume that this means that there is nothing wrong with the way I write the data into the file. However, it would be useful for me to be able to read it directly from Labview without having to build matlab executables etc etc...
    cheers again

  • Read binary file information from servlet - from database accessor method

    Okay, I have been working on this for awhile now and I just plain dont know what I am doing. Could someone please help me? I cannot find any examples through google or the forums for this specific type of situation( as in a servlet calls a method which gets binary file from a database).
    - How do I get the inputStream into the servlet so that I can read it?
    - Why am I getting the error message that OutputStream has already been called?
    If someone could give me direction or simply tell me what I should look up - I would really really appreciate it.
    The Servlet
    response.setContentType("application/msword");
    response.setHeader("Content-disposition","attachment; filename="+ file + ext);
    OutputStream os = response.getOutputStream();
    OOT openAttachments = searchInfo.openAttachments(newID, oot, ootNum, file, ext, os);
    InputStream is2 = oot.getIs();
        byte b[] = new byte[16384];
        int numBytes;
            while((numBytes=is2.read(b))!=-1){
                os.write(b,0,numBytes);
                System.out.println("is - in while" + is);
            is2.close();
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/ootMain.jsp?newID="+newID);
    dispatcher.forward(request, response);
            os.flush();
            os.close();
    The Method
    public OOT openAttachments(String newID, OOT oot, String ootNum, String file,
                               String ext, OutputStream os) {
        this.conn = database.SybaseDAO.grabConnection();
        String query = " edited for space'";
        state = conn.createStatement();
        rs = state.executeQuery(query);
            if(rs.next()){
               InputStream is = rs.getBinaryStream(2);
               oot.setIs(is);
               System.out.println("is - in while" + is);
               is.close();
    Error Messages
    (is - in while - method)    sun.jdbc.odbc.JdbcOdbcInputStream@c02a
    (is2 - after - servlet)      sun.jdbc.odbc.JdbcOdbcInputStream@c02a
    IOException: java.io.IOException: InputStream is no longer valid - the Statement
                                      has been closed, or the cursor has been moved
    Mar 14, 2005 9:53:19 AM org.apache.catalina.core.ApplicationDispatcher invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    java.lang.IllegalStateException: getOutputStream() has already been called for this responseThanks for your help/time -
    Crystal

    Here is the entire exception:
    Mar 16, 2005 9:32:44 AM org.apache.catalina.core.ApplicationDispatcher invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    java.lang.IllegalStateException: getOutputStream() has already been called for this response
         at org.apache.catalina.connector.Response.getWriter(Response.java:596)
         at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:161)
         at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:111)
         at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:122)
         at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:115)
         at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:182)
         at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:115)
         at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)
         at org.apache.jsp.ootMain_jsp._jspService(org.apache.jsp.ootMain_jsp:596)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:302)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:246)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:682)
         at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:581)
         at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:501)
         at oot.display_files.doGet(display_files.java:63)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:106)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:576)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)
    Mar 16, 2005 9:32:44 AM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet display_files threw exception
    java.lang.IllegalStateException: getOutputStream() has already been called for this response
         at org.apache.catalina.connector.Response.getWriter(Response.java:596)
         at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:161)
         at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:111)
         at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:122)
         at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:115)
         at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:182)
         at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:115)
         at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)
         at org.apache.jsp.ootMain_jsp._jspService(org.apache.jsp.ootMain_jsp:596)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:302)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:246)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:682)
         at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:581)
         at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:501)
         at oot.display_files.doGet(display_files.java:63)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:106)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:576)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)Line 63 is the include...

  • Display PDF in different window by reading Binary file in MIME folder.

    Hi all,
    I've kept binary file in MIME folder and I'm trying to read the contents of it. and I'm trying to display contents in pdf format in separate window.
    For this I was able to read the file by using FileInputStream
    byte[] bytes = new byte[1000];
         try
                  //File file = new File(WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(),"data.bin"));
                   File file = new File(WDURLGenerator.getResourcePath("test.bin"));
                   FileInputStream is = new FileInputStream(file);
                  long length = file.length();
                   //Create the byte array to hold the data
                   byte[] bytesA = new byte[(int)length];
                   //Read in the bytes
                    int offset = 0;
                    int numRead = 0;
                    while (offset < bytesA.length&& (numRead=is.read(bytesA, offset, bytesA.length-offset)) >= 0)
                         offset += numRead;
                        is.close();
                   bytes = bytesA;
                   wdContext.currentContextElement().setPdfSource(bytes);
                 catch(Exception e)
                   wdComponentAPI.getMessageManager().reportException("Error Reading File:"+e.getCause(),true);
                   wdComponentAPI.getMessageManager().reportException("Error Reading File To String:"+e.toString(),true);
    I've to show this in external window. I created attribute "pdfResource" of type binary
    and declared in the source
    private ISimpleType myPdfDoc;
    After that I added this bit of code in Init Method
    myPdfDoc = wdContext.getNodeInfo().getAttribute("pdfResource").getModifiableSimpleType();
    ((IWDModifiableBinaryType)myPdfDoc).setMimeType(WDWebResourceType.PDF);
    ((IWDModifiableBinaryType)myPdfDoc).setFileName("PDF");
    After this I made an action handler which has following code.
    final byte[] documentContent = bytes
    final String docUrl = myPdfDoc.format( bytes );
    String docUrl = myPdfDoc.format(bytes);
    IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow(docURL,"Resource", true);
    window.open();
    But it is throwing Null Pointer exception for Init Method and also while displaying.
    Where is that I'm faltering. Any Pointers will be help ful
    Thanks
    Srikant

    First of all why do you need those three lines of code in your wdDoInit() ?
    Simply, you may use this:
    IWDCachedWebResource cachedResource = null;
    String url = null;
    byte[] pdf = wdContext.currentContextElement().getPdfSource();
    if (pdf != null) {
       cachedResource = WDWebResource.getWebResource(pdf, WDWebResourceType.PDF);
       url = cachedResource.getURL();
    Refer <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/4a/fb8342a7d30d53e10000000a155106/content.htm">Utilizing the IWDCachedWebResource-API</a> for further assistance.
    /* Changed the code */
    Message was edited by: Bala Krishnan

  • Upload and read binary files

    I have created ADF form with input file item for initiator human task ( to upload a binary file)
    In the second form, I want see link of the file uploaded and I want open the file in other window ( to see the content of the binary file)
    How can I do?
    Thanks Elena

    Azazel,
    Looks like you are just being an over achiever.  There are VI's specifically written for reading and writing binaries.  I would guess that the VISA timeout is caused by the way you are calculating the size of the file.  Since it is too big the VISA session will time out.  See attached example for the easy way to do this.
    Matt
    Matthew Fitzsimons
    Certified LabVIEW Architect
    LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
    Attachments:
    RWbinary1.vi ‏100 KB

  • Seeking a read binary file example

    suppose a binary file contains data
    1 2 3 4 5 6
    How to read it and print out to vertify?
    Thanks

    this is my code
    import java.io.*;
    public class MainClass {
      public static void main(String args[]) {
       int readBytes;
       byte[] data = new byte[1024];
          try{
            FileInputStream in = new FileInputStream("plotdata");
                    DataInputStream isr = new DataInputStream(in);
                   String s = null;
               while ((readBytes = in.read(data)) != -1) {
                       s = new String(data,"Cp1252");
              System.out.println(s);
            in.close();
                    }catch (IOException e){System.out.println(e.getMessage());}           
      }The output is
    @G6C1
    @0?? ?}??*????????}rZ????ec?????     ??tz????3=???G??IL?????how to make it readable for each line, it seems invokes with endian mode.
    thanks

Maybe you are looking for

  • Error while importing categories to Outlook calendar

    Hi there! I'm sharing an Outlook calendar with my colleagues, and its events are categorized with colors. I found this page for importing the categories to every local machine, and it worked! But for 2 users only were imported three of four categorie

  • HELP my ipod keeps going into restore mode

    hi i have a problem with my ipod touch 2nd generation firmware 3.1.2. it keeps going into restore mode randomly when i play with ir or use it. i upgraded and downgrade and nothing seems to work. i think there is a problem with the hardware! oh and wh

  • Problem regarding running war file in Tomcat 4.1

    i uploaded a war file in Tomcat application manager.. Running status of application is false ... By pressing START in COMMANDS still it shows false in RUNNING .. i got error FAIL - Application at context path /kannan could not be started...........

  • What are crystal reports ?

    Hello,          Please explain me wht are crystal reports i dont know even wht are they. I have got a task to prepare a crystal report, please do help me achieve this. Points will be awarded for the helpful answer. Thks

  • IMac 350 Upgrade

    Hi, I recently decided to attempt to upgrade my iMac 350 and would like to check a few things before i get started. First of all, i am primarily wanting to put OS X on my iMac and then wanting to fit it with an airport card. I have read on many diffe