Write Files through return channel

Hi,
i'm newer in this forum. I'm working in a MHP project, and I want to comunicate STB with the server (in this case, a PC running Apache Server).
The question is �can I write a file in the server with data obtained on the STB? I think that it is posible via return channel, but i'm not sure. The idea is to write file (on the server) with the solutions entered by TV user in an application that have some tests. �Are other ways besides return channel to do it?
Thanks ;)
Regards

Hello here you an example of login in my application:
package es.admin.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import es.admin.bd.PacienteBD;
import es.admin.beans.Paciente;
import es.admin.dao.PacienteDAO;
* Servlet implementation class for Servlet: LoginPatient
public class LoginPatient extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
   static final long serialVersionUID = 1L;
    /* (non-Java-doc)
      * @see javax.servlet.http.HttpServlet#HttpServlet()
     public LoginPatient() {
          super();
     /* (non-Java-doc)
      * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          // TODO Auto-generated method stub
          processRequest(request,response);
     /* (non-Java-doc)
      * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          // TODO Auto-generated method stub
          processRequest(request,response);
     private void processRequest(HttpServletRequest request,HttpServletResponse response) throws IOException
          Paciente paciente = new Paciente();
          paciente.setDni(request.getParameter("dni"));
          paciente.setContrasenia(request.getParameter("contrasenia"));
          boolean ok = PacienteBD.compruebaPaciente(paciente.getDni(),paciente.getContrasenia());
          response.setContentType("text/plain;charset=UTF-8");
          PrintWriter p = response.getWriter();
          if (ok)
               p.println("true");
          else
               p.print("false");
public class PacienteBD {
     public static boolean compruebaPaciente(String dni,String password)
          boolean correcto = false;
          Paciente aux = PacienteDAO.BuscarPaciente(dni);
          if ((aux!=null)&&(aux.getContrasenia().equals(password)))
               correcto = true;
          return correcto;
}then you use from the java code :
new URL ("http://admin/login?usuario=xxx&passw=xxx")
thats all

Similar Messages

  • Delete specific attachment file through Conversion Channel ?

    version : iMS5.2 sp1
    O/S : Solaris 2.6 Generic_105181-29
    I wanted to delete specific attachment file(ex: ALTDESK.ZIP) through Conversion Channel.
    So I set up like below..
    1) In mappings file
    =================
    CONVERSIONS
    IN-CHAN=tcp_intranet;OUT-CHAN=tcp_local;CONVERT Yes
    ==============
    I only want to delete attached file from tcp_intranet to tcp_local.
    2) msg-INSTANCE/imta/config/conversions
    example mail header ::
    --- omit ----
    MIME-version: 1.0
    X-Mailer: iPlanet Messenger Express 5.2 Patch 1 (built Aug 19 2002)
    Content-type: multipart/mixed; boundary=--6b2385053506b85
    Content-language: ko
    X-Accept-Language: ko
    Priority: normal
    This is a multi-part message in MIME format.
    ----6b2385053506b85
    Content-Type: text/plain; charset=EUC-KR
    Content-Disposition: inline
    Content-Transfer-Encoding: quoted-printable
    ----6b2385053506b85
    Content-Type: application/x-zip-compressed
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment; filename=ALTDESK.ZIP
    - conversions file setting
    ==================================================
    in-channel=tcp_intranet; out-channel=tcp_local;
    in-type=application; in-subtype=x-zip-compressed;
    parameter-symbol-0=ALTDESK.ZIP; parameter-copy-0=*;
    dparameter-symbol-0=ALTDESK.ZIP; dparameter-copy-0=*;
    message-header-file=2; original-header-file=1;
    override-header-file=1; override-option-file=1;
    command="/product/leeky/convert.sh"
    ============================================
    3) /product/leeky/convert.sh file
    ========================
    #!/bin/sh
    if [ $? -eq 1 ]; then
    echo "STATUS=178030178" >> $OUTPUT_OPTIONS
    else
    cp $INPUT_FILE $OUTPUT_FILE
    fi
    =========================
    4) The problems I face are
    - All of zip files which are filtered is deleted. As you can see 2) I only want to delete ALTDESK.ZIP file
    But, all of the zip-compressed files are deleted at the moment.
    - This converison channel is work(even if all zip-compressed files are deleted). But sometimes this is not
    working(2 or 3 times out of 10). I don not know why.
    - Above all, I am not sure 2) and 3) settings are good. English is a second language to me. So it was
    not easy to understand conversion channel setting in Admin Guide.
    - How can I see the out put of "$OUTPUT_OPTIONS" ? I do not know where I can see that.
    Is there anybody to help me ?

    The section of the admin guide which can help is:
    http://docs.sun.com/source/816-6009-10/channel2.htm#42283
    Here there is an explanation of how the mime headers of the message part would align with the entries one would put into the conversions file entry. (The document has an error where it talks about APPARENT_NAME and APPARENT_FILENAME. It should really say the words "NAME" and "FILENAME" respectively).
    Based on that document, the MIME headers of your message part :
    Content-Type: application/x-zip-compressed
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment; filename=ALTDESK.ZIP
    will align with a conversions file settiong of:
    in-channel=tcp_intranet; out-channel=tcp_local;
    in-type=application; in-subtype=x-zip-compressed;
    parameter-symbol-0=NAME; parameter-copy-0=*;
    dparameter-symbol-0=FILENAME; dparameter-copy-0=*;
    message-header-file=2; original-header-file=1;
    override-header-file=1; override-option-file=1;
    command="/product/leeky/convert.sh"
    and a /product/leeky/convert.sh script which reads something like:
    #!/bin/sh
    grep "$FILENAME" /product/leek/badfiles.list
    if [ $? -eq 1 ]; then
    echo "STATUS=178030178" >> $OUTPUT_OPTIONS
    else
    grep "$NAME" /product/leek/badfiles.list
    if [ $? -eq 1 ]; then
    echo "STATUS=178030178" >> $OUTPUT_OPTIONS
    else
    cp $INPUT_FILE $OUTPUT_FILE
    fi
    fi
    The lines:
    parameter-symbol-0=NAME; parameter-copy-0=*;
    dparameter-symbol-0=FILENAME; dparameter-copy-0=*;
    tells the conversion channel to make the environment variable $NAME avaliable to your program with a value corresponding to the "name=" clause on the Content-Type line of the MIME headers. The environment variable $FILENAME is made avalable to your program and takes on the value extracted from the filename=" clause on the content-disposition line of the MIME headers.
    The document at :
    http://docs.sun.com/source/816-6092-10/conversion.html
    may help provide other examples.

  • TNS Packet writer failure and end-of-file on communication channel

    Hello Sir/Mam,
    I m working on oracle server 9i. when i insert data into Blob,Nclob,Clob field which is larger than 4KB, this message occur everytimes.(TNS Packet writer failure or end-of-file on communication channel).
    Can u tell me why this happen when i insert large data from 4KB.
    I m using oledb to insert data into a table.if datasize is less than 4 KB ,its easily insert.
    My Code Module is this
    BOOL CconnectivityDlg::OpenOracleFile()
         BOOL bResult=FALSE;
         bFile = FALSE;
         dwFileSize = 0;
         CString csVirtualPath;      
         CFileDialog dlg(TRUE);
         if(dlg.DoModal()==IDOK)
              StrName = dlg.GetPathName();
         hFile1=CreateFile(StrName,GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
                                       NULL,OPEN_EXISTING, NULL,NULL);
         unsigned int count =0;
              if(hFile1==INVALID_HANDLE_VALUE)
                   if(count<5)
                        count++;
                        Sleep(1000);
                   else
                        return bResult;
         DWORD dwHighPart,dwLowPart;
         dwLowPart = GetFileSize(hFile1,&dwHighPart);
         LARGE_INTEGER NewFilePointer;
         NewFilePointer.LowPart = dwLowPart;
         NewFilePointer.HighPart = dwHighPart;
         dwFileSize = NewFilePointer.QuadPart;     
         bFile     = TRUE;
         bResult = TRUE;     
         if(hFile1)
              CloseHandle(hFile1);
              hFile1 =NULL;
         return bResult;
    BOOL CconnectivityDlg::CreateConnection()
         BOOL bResult = FALSE;     
         CString Count,strFileSaveName;
         Count.Empty();
         strFileSaveName.Empty();
         unsigned int nCounter = 0;     
    repeat:     
         if(!AfxOleInit())
              return FALSE;
         m_pConn.CreateInstance (__uuidof(Connection));
         CString strConn ;
         strConn.Empty();
         m_pConn->CursorLocation = adUseClient;
         strConn     =_T("Provider=MSDAORA;OSAuthent=1;Data Source =LOVE;Connect as =SYSDBA;");
         try
              m_pConn->Open(_bstr_t(strConn),_bstr_t("system"),_bstr_t("system"),adConnectUnspecified);
              bResult = TRUE;
         catch(_com_error& e)
              CString sBuff = GetErrorDescription(e);
              AfxMessageBox(sBuff);
              return 0;          
         catch(...)
              AfxMessageBox(_T("UnknownError"));
              return 0;
         m_pCom.CreateInstance(__uuidof(Command));
         try
              m_pCom->ActiveConnection = m_pConn;
         catch(_com_error& e)
              CString sBuff = GetErrorDescription(e);
              AfxMessageBox((sBuff));          
         catch(...)
              AfxMessageBox(_T("UnknownError"));
         return bResult;
    CString CconnectivityDlg::insertimage()
         CString Query,ColmnName;
         Query.Empty();
         ColmnName = _T("FIRST");//Coloumn Name
         Query = _T("insert into SINGLE(FIRST) values (?)"); //Table in which i want to insert data of Nclob type.
         hFile1 = CreateFile(StrName,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);//File from i read the data to insert into nclob field
         DWORD dwHighPart,dwLowPart;
         dwLowPart = GetFileSize(hFile1,&dwHighPart);
         LARGE_INTEGER NewFilePointer;
         NewFilePointer.LowPart = dwLowPart;
         NewFilePointer.HighPart = dwHighPart;
         dwFileSize = NewFilePointer.QuadPart;     
         BYTE *ImageData = new BYTE[dwFileSize+2];
         memset(ImageData,0,dwFileSize+2);
         BOOL bRead = ReadFile(hFile1,ImageData,dwFileSize,&dw,NULL);
         VARIANT varChunk;
         long lngOffset=0;
         UCHAR chData;
         SAFEARRAY FAR *psa = NULL;
         SAFEARRAYBOUND rgsabound[1];
         rgsabound[0].lLbound=0;
         rgsabound[0].cElements=dwFileSize;
         psa = SafeArrayCreate(VT_UI1,1,rgsabound);
         HRESULT hr;
         while(lngOffset < (long)dwFileSize)
              chData = ((UCHAR*)ImageData)[lngOffset];
              hr = SafeArrayPutElement(psa,&lngOffset,&chData);
              lngOffset++;                                        
         lngOffset     = 0;
         varChunk.vt=VT_ARRAY|VT_UI1;
         varChunk.parray=psa;
              try
              m_pCom->Parameters->Append(m_pCom->CreateParameter(_bstr_t(ColmnName),adLongVarWChar,adParamInput,(ADO_LONGPTR)dwFileSize,varChunk));
              VariantClear(&varChunk);
         catch(_com_error& e)
              CString sBuff = GetErrorDescription(e);
              AfxMessageBox(sBuff);
         if(ImageData)
              delete[] ImageData;
              ImageData = NULL;
         try
              m_pCom->CommandText=_bstr_t(Query);
              m_pConn->CursorLocation = adUseClient;
              m_pCom->CommandTimeout=0;
              m_pCom->Execute(NULL,NULL,adCmdText);
         catch(_com_error& e)
              CString sBuff = GetErrorDescription(e);
              AfxMessageBox(sBuff);
         return 0;
    CString CconnectivityDlg::GetErrorDescription(_com_error& e)
    bstrt bstrSource(e.Source());
    bstrt bstrDescription(e.Description());
    _TCHAR szTemp[1024];
    CString strInfo ;
    wsprintf(szTemp, _T("Message : %s\n"), e.ErrorMessage());
    strInfo = szTemp;
    wsprintf(szTemp, _T("Code : 0x%08lx\n"), e.Error());
    strInfo += szTemp;
    wsprintf(szTemp, T("Source : %s\n"), bstrSource.length() ? (LPCTSTR)bstrSource : T("null"));
    strInfo += szTemp;
    wsprintf(szTemp, T("Description : %s\n"), bstrDescription.length() ? (LPCTSTR)bstrDescription : T("null"));
    strInfo += szTemp;
         CString str     =     strInfo;
         if(str.Find(_T("not a valid password"),0) > 0)
              strInfo     =     _T("File is password protected") ;
    return strInfo;
    }

    user7728510 wrote:
    Hi,
    for what i know, MSDAORA provider doesn't support Oracle data types introduced since <font face="tahoma,verdana,sans-serif" size="1" color="#000">version</font> 8, as CLOB, BLOB and so on, so i think that it uses varchar2 up to the 4k limits and then causes this error.
    Have you tried with the OraOLEDB.Oracle.1 provider instead?Nice writing, Thanks for your explanation!

  • Loop through a csv file and return the number of rows in it?

    What would be simplest way to loop through a csv file and
    return the number of rows in it?
    <cffile action="read" file="#filename#" output="#csvstr#"
    >
    <LOOP THROUGH AND COUNT ROWS>

    ListLen(). Use chr(13) as your delimiter

  • I'm downloading a large file through Safari, but it keeps returning to the homescreen and the download stops. How do I stop this?

    I'm downloading a large file through Safari, but it keeps returning to the homescreen and the download stops. How do I stop this?

    If it's not a jpeg or PDF, you can't download it on the iPad.

  • Write 32 channels thermistor data (temp in degree vs date/time) into xls file for all channels continuously.

    i am acquiring 32 channels thermistor data (temp in degree vs date/time) in waveform plot using array to cluster function  ,
    now my problem is how to write this data  into xls file for all channels continuously.
    please help me at the earliest & i am new to Labview.

    Hi Priyanka,
    Writing to excel file continuously is not a good idea, you can use ".CSV" or TDMS file format and once data acquisition is completed you can convert that to excel file using report generation toolkit.
    With Regards
    Miraz
    Kudos is better option to thank somebody on this forum

  • Can anyone help me in sending a file through FTP

    i have written a program to transfer files or directories in zipformat through FTP.i have also installed filezella server to check whether it is working or not.i have connected to filezella server but i am not able to send file.can any one send the code for sending the file.
    i have also tried the jakarta api sendfile ().but in that i don't what is mode means.
    for your reference i am sending the code as far developed.
    import java.io.*;
    import java.util.*;
    import java.util.zip.*;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipInputStream;
    import org.apache.commons.net.ftp.*;
    import org.apache.commons.net.tftp.*;
    class FTPTransfer
    static public void main(String[]p)
    FTPTransfer ob = new FTPTransfer();
    // ob.Create_Zip_File(new File("outfile.zip"),new File[]{new File("c:\\trialtwo")}, false);
    ob.ftpConnect();
    // connecting to FTP server
    public void ftpConnect()
    boolean error = false;
    FTPClient ftp = null;
    try
    int reply;
    //ftp.connect("ftp.comcast.com");
    ftp = new FTPClient();
    ftp.connect( "localhost",21);
    // ftp.login( username, password );
    System.out.print("reply from FTP Server :"+ftp.getReplyString());
    // After connection attempt, you should check the reply code to verify
    // success.
    reply = ftp.getReplyCode();
    if(!FTPReply.isPositiveCompletion(reply)) {
    ftp.disconnect();
    System.err.println("FTP server refused connection.");
    System.exit(1);
    // ftp.sendFile();
    // transfer files
    // ftp.logout();
    TFTPClient tftp = new TFTPClient();
    System.out.print("before sending");
    tftp.sendFile("c:\\trialtwo\\a-1.txt",1,new FileInputStream("c:\\trialtwo\\a-1.txt"),"localhost",21);
    System.out.print("after sending");
    catch(IOException e)
    error = true;
    e.printStackTrace();
    finally
    if(ftp.isConnected())
    try
    ftp.disconnect();
    catch(IOException ioe)
    // do nothing
    System.exit(error ? 1 : 0);
    //send files
    // filename - The name the remote server should use when creating the file on its file system.
    // mode - The TFTP mode of the transfer (one of the MODE constants).
    // host - The remote host receiving the file.
    //port - The port number of the remote TFTP server.
    private void listContents( File Zip_File, File dir, ZipOutputStream out )
    throws Exception
    String[] files;
    files = dir.list();
    byte[] buf = new byte[1024];
    File[] file = dir.listFiles();
    for (int i = 0; i < file.length; i++) {
    System.out.println("*********** "+file);
    // File f = new File(dir,file[i]);
    try{
    FileInputStream in = new FileInputStream(file[i]);
    out.putNextEntry(new ZipEntry(file[i].getPath()));
    int len;
    while((len = in.read(buf)) > 0) {
    out.write(buf, 0, len);
    in.close();
    catch(Exception e)
    zipEntry(Zip_File, file[i], out);
    } // end listContents()
    void Create_Zip_File(File Zip_File,File[] To_Be_Zipped_Files,boolean Skip_Dirs)
    try
    // Open archive file
    FileOutputStream stream=new FileOutputStream(Zip_File);
    ZipOutputStream out=new ZipOutputStream(stream);
    for (int i=0;i<To_Be_Zipped_Files.length;i++)
    //if (To_Be_Zipped_Files[i]==null
    // || !To_Be_Zipped_Files[i].exists()
    // || (Skip_Dirs ))
    // continue;
    System.out.println("Adding "+To_Be_Zipped_Files[i].getName());
    zipEntry(Zip_File, To_Be_Zipped_Files[i], out);
    out.close();
    stream.close();
    System.out.println("Finished zipping : "+ Zip_File.getAbsolutePath());
    catch (Exception e)
    e.printStackTrace();
    System.out.println("Error: " + e.getMessage());
    return;
    private void zipEntry(File Zip_File, File file, ZipOutputStream out) throws Exception
    if (file.isDirectory())
    listContents(Zip_File, file, out);
    return;

    You'll stand a better chance of getting help if you're more specific about what problems you're encountering. "Can't send file" doesn't say much.
    When you post code, please use[code] and [/code] tags as described in Formatting tips on the message entry page. It makes it much easier to read.

  • ORA-07445 and ORA-01331end-of-file on communication channel

    Hi,
    : Can any one help?
    : We have an oracle server 8.1.7 on Solaris 8 sparc station.
    : And after trying to run a select query on the database we are
    : *** SESSION ID:(10.40322) 2001-05-09 13:56:06.479
    Exception signal: 11 (SIGSEGV), code: 1 (Address not mapped to object), addr: 0xc7e25fe, P
    C: dredseek()+396
    *** 2001-05-09 13:56:08.069
    ksedmp: internal or fatal error
    ORA-07445: exception encountered: core dump [dredseek()+396] [SIGSEGV] [Address not mapped
    to object] [209593854] [] []
    Current SQL statement for this session:
    SELECT ID, Kurztitel, KURZTITEL_BESCHR, Mittel, MITTEL_DEF, Wirkung, WIRKUNG_DEF, Status,
    Person_ID, Patent_ID, Typ FROM ENTWICKLUNG WHERE ID IN (SELECT REFERENZ_ID FROM BEZUG WHER
    E ID IN (SELECT ID FROM EMP WHERE ( CONTAINS(LAIM,'%drill%')>0 OR CONTAINS(DESCRI
    PTION,'%drill%')>0) AND ( CONTAINS(LAIM,'%seal%')>0 OR CONTAINS(DESCRIPTION,'%seal%')>0))
    ) AND Typ!=4 AND Typ!=3 AND Typ!=5
    : ORA-03113: end-of-file on communication channel .
    : Sascha
    null

    Yes i am connecting through client side(TOAD).
    When i continously execute the query then there is no problem. But problem occurs when i sits idle more than approx. 2 minutes.
    Listner is properly running at server side.
    Also while connecting though toad
    1st Error is
    Ora-12571: TNS: PAcket write failure
    Ora-12541: TNS: No Listener
    Then it connects.
    What is the problem?
    Where i can look into?
    Thanks,

  • How to parse CAN DBC file through CVI

    Hi ,
    I would like to know if we can parse the CAN .dbc file through CVI, let me know if there is any other approach, We use Labwindows CVI for our testing and we would like to know if we can parse through the .dbc file to get the PGN and SPN information and use them in our testing process. We do not use NI CAN cards etc we use a Supercom to transmit and recieve the messages.
    Thanks in Advance
    Kishore

    AndreasS wrote:
    Hi Kishore,
    you can use the NI-CAN or NI-XNET functions to read data from .dbc files. XNET is more advanced, but so far you can't to frame to channel conversion without hardware (coming soon).
    So I recommend using NI-CAN. There you can read the channel information fom the dbc file using CAN Get Names and CAN Get Property.
    You can convert the CAN channels into frames using either the virtual CAN interfaces 256 and 257 (both c and LabVIEW) or using the CAN Channel to Frame conversion library (only LabVIEW). Then you just have to write the frame data on your CAN interface.
    NI-CAN manual
    NI-XNET manual
    NI-CAN Virtual Ports
    Regards,
    When you say "coming soon", when is this anticipated to be out?  Also, can you use virtual CAN channels with XNET like you can with NI-CAN?
    I'm trying to determine whether I should write all my new programs using XNET instead of NI-CAN, so anything you can contribute would be appreciated.  Also, is there a significant reason to use XNET instead of NI-CAN if I'm only using CAN and don't care about FlexRay or other protocols?
    Message Edited by KavehV on 03-22-2010 05:48 PM

  • Transfering a file through Socket programming

    Hi all,
    I want to return a file from server to client through a socket. I tried using ObjectOutput Stream where in I returned a java.io.File from server. But at client side when I say file.getLeangth() it comes as 0 and if I try to assign FileInputStream on the object it throws an exception as the file not found as the path associated with the file will be of Server.
    So can anyone help as to how to transfer a file through socket programming???
    thx in advance
    MK

    java.io.File is NOT the contents of the file. It really just represents the path.
    If you want to transfer the file's contents, you'll have to use a FileInputStream or FileReader, read from it, and then write the bytes or chars on the wire.

  • Help with Read/Write File

    hi I was wondering if someone can help me do some read/write file with java. here is what I want to do:
    Read a file and search the whole file for a word such as "throw" and print out the rest of that line to a new file. in the case of "throw", i want to link all thrown exceptions to the file that contained them.
    can someone help me out and let me know what way I can approach in this?
    any help would be greatly appreciated.
    thanks!

    Rough and dirty, here's a class that will read a file and return a resultset:
    import java.io.*;
    import java.nio.*;
    import java.nio.channels.FileChannel;
    import java.util.*;
    import java.text.DateFormat;
    public class Utils{
         File fileName;
         FileOutputStream outputFile;
         boolean closeChannel;
         //Constructor
         public Utils(String directory, String filename){
              String strFileDir = directory;
              String strFileName = filename;          
              File fileDir = new File(strFileDir);
              fileName = new File(fileDir, strFileName);
              // If directory does not exhist, create it.
              if(!fileDir.isDirectory()){
                   if(fileDir.mkdirs()){
                        System.out.println(fileDir + " created.");
                   else{
                        System.out.println(fileDir + " could not be created.");                    
    public ArrayList readText() throws IOException{          
              // Read content of file into a collection
              ArrayList arrayList = new ArrayList();
              try{
                   BufferedReader in = new BufferedReader(new FileReader(fileName));
                   String line;
                   while((line = in.readLine()) != null){
                        arrayList.add(line);
                   in.close();               
              catch (IOException ex){
                   throw ex;
              return arrayList;          
         }And here's how you use the class:
    // Create a new Disk Utilities object.  This can be used for all subsequent read/writes to this file.
              Utils utilTest = new Utils("e:/testing", "Testing.txt");
    // Create a collection to hold the data from the file.
              ArrayList arrayList = new ArrayList();
              try{arrayList = utilTest.readText();}catch(IOException ex){ex.printStackTrace(System.err);}

  • Starting event on a server from a STB via return channel - possible?

    Hello!
    I try to create an application in MHP to send an emergency-call via a STB.
    The STB is permanently connected to a server (intranet). Now I want to launch an event (popup-window, playing sounds, etc.) on the server via the STB.
    I thought of RPC, but didn't get it to work.
    I am able to write files on the server (via FTP). Is ist possible to monitor a directory and kick an event if a file is created?
    Thanks for help!

    It's certainly possilbe on the server side. This is more a question of how your server software is implemented and whether doing this imposes too much of a load on your server.
    I'm surprised that you couldn't get RPC to work. The return channel connection in an MHP box should support any IP traffic, although you will have to implement most of the protocol yourself.
    Steve.

  • Diadem write file

    Hi, I have a VI that uses the "DIAdem Write File" function to save a channel array from cFP to a .dat file. The data I could see well in DIAdem. The problem is that everytime I make a acquisition, I need to acquire to the time and the date of acquisition. But I'm not saying time like duration of the acquisition. The time of the acquisition needs to be like this example: 01/01/2005 13:45:20. I could do this once using the time channel and time parameters connectors, but, when I make another acquisition, the value of this channel is updated. For example: I make a acquisition in 01/01/2005 13:45:20. If I make another acquisition in 01/01/2005 13:50:05, the data from cFP appear OK, but the time channel appear with the first acquisition 01/01/2005 13:50:05 and the second acquisition 01/01/2005 13:50:06. I don't know how to add a time channel to the channel array (I neither know if it's possible), and using this time channel connector the results isn't the expected. There are a way to do this? Any help will be appreciated

    You can use the Get Date/Time in Seconds.vi in LabVIEW to return a timestamp to you. I would suggest placing the Get Date/Time in Seconds.vi in a sequence structure along with the data acquisition vi. Then, you will have the timestamp associated with that particular data acquisition. You can then convert the timestamp to a string (also look in the Time and Dialog palette for the Get Date/Time String.vi) and you can then append that to the string of information you’re are writing out to the file.
    Hope this helps. Best of luck.
    Kileen

  • Convrtd to Invterval Part- ORA-03113: end-of-file on communication channel

    Hi all,
    I had a table as Interval Partitioned. In order to create XML- Xpath indexes on it, I converted it to Range Partitioned table.
    I am able to create the XPATH indexes but I get the error: ORA-03113: end-of-file on communication channel
    - When I revert the code to Interval Partitioned without the XMLIndex, it works fine(although takes time as no XML Index)
    - When I convert table to non partitioned table, create the XML Index, it works fine.
    But I need the partitons, so when I create the partitioned table I get the error.
    CREATE TABLE INT_PART_TABLE
    DB_ID VARCHAR2(10 BYTE),
    xML_mESSAGE SYS.XMLTYPE,
    LOAD_TIMESTAMP TIMESTAMP(6)
    XMLTYPE xML_mESSAGE STORE AS BINARY XML
    PARTITION BY RANGE (LOAD_TIMESTAMP)
    PARTITION MAX VALUES LESS THAN (TIMESTAMP' 2013-06-01 00:00:00')
    TABLESPACE CSTR_STG_DATA
    NOCOMPRESS
    NOCACHE
    ENABLE ROW MOVEMENT;
    BEGIN
    DBMS_XMLINDEX.dropparameter('Indx_Par');
    END;
    BEGIN
    DBMS_XMLINDEX.REGISTERPARAMETER(
    'Indx_Par',
    'PATH TABLE Table1
    PATHS (INCLUDE ( /abc:field1/xyz:field2
    /abc:field1/def:field2
    NAMESPACE MAPPING ( xmlns:abc="ABCD"
    xmlns:def="DEFG"
    xmlns:xyz="XYZA"
    end;
    create index INDX_XPATHS on "INT_PART_TABLE" (XML_MESSAGE) indextype is xdb.xmlindex
    parameters ('PARAM Indx_Par') local;
    Now if I execute the following statement in
    SELECT T.xML_mESSAGE
    FROM INT_PART_TABLE1 T
    WHERE XMLEXISTS (
    declare namespace abc="ABCD";
    declare namespacedef="DEFG";
    declare namespace xyz="XYZA";
    let $tt as xs:boolean := fn:exists($p/main/id = ("144283","9085802")])
    return if ($tt) then true()
    else ()'
    PASSING T.xML_mESSAGE AS "p");
    - Is there any other way of writing this Select statement, which may work?
    - Any other thing I need to take care of when defining the table and partitions script so that I don't get this error?

    Hi,
    I think it's time you give a clear (and working) test case so that we can safely try to reproduce the issue.
    What you've given so far has syntax error and name mismatch.
    So please :
    - database version (SELECT * FROM v$version)
    - complete sequence of DLLs
    - some sample XML documents (it doesn't have to be the real ones, but at least something realistic)
    Thanks in advance.
    declare namespace abc="ABCD";
    declare namespacedef="DEFG";
    declare namespace xyz="XYZA";
    let $tt as xs:boolean := fn:exists($p/main/id = ("144283","9085802")])
    return if ($tt) then true()
    else ()'Why all that stuff? You don't have to return a boolean.
    The following works for me on 11.2.0.3 :
    SQL> CREATE TABLE int_part_table (
      2    db_id          VARCHAR2(10)
      3  , xml_message    XMLTYPE
      4  , load_timestamp TIMESTAMP
      5  )
      6  XMLTYPE xml_message STORE AS BINARY XML
      7  PARTITION BY RANGE (load_timestamp) (
      8    PARTITION MAX VALUES LESS THAN (timestamp '2013-06-01 00:00:00')
      9  )
    10  NOCOMPRESS
    11  NOCACHE
    12  ENABLE ROW MOVEMENT;
    Table created
    SQL> insert into int_part_table values (1, xmltype('<main><id>144283</id></main>'), sysdate);
    1 row inserted
    SQL> insert into int_part_table values (1, xmltype('<main><id>9085802</id></main>'), sysdate);
    1 row inserted
    SQL> insert into int_part_table values (1, xmltype('<main><id>1</id></main>'), sysdate);
    1 row inserted
    SQL> commit;
    Commit complete
    SQL> create index int_part_table_uix on int_part_table (xml_message)
      2  indextype is xdb.xmlindex
      3  parameters (
      4  'PATH TABLE INT_PART_TABLE_PT
      5  PATHS ( INCLUDE ( /main/id ) )')
      6  local;
    Index created
    SQL> SELECT xml_message
      2  FROM int_part_table
      3  WHERE XMLExists(
      4         '/main[id=("144283","9085802")]'
      5         PASSING xml_message
      6       )
      7  ;
    XML_MESSAGE
    <main>
      <id>144283</id>
    </main>
    <main>
      <id>9085802</id>
    </main>
    Execution Plan
    Plan hash value: 3517234298
    | Id  | Operation                              | Name                         | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | SELECT STATEMENT                       |                              |     1 |   155 |    34   (6)| 00:00:01 |       |       |
    |   1 |  NESTED LOOPS                          |                              |     1 |   155 |    34   (6)| 00:00:01 |       |       |
    |   2 |   VIEW                                 | VW_SQ_1                      |     1 |    25 |    32   (4)| 00:00:01 |       |       |
    |   3 |    HASH UNIQUE                         |                              |     1 |    47 |         |             |       |       |
    |*  4 |     HASH JOIN SEMI                     |                              |     1 |    47 |    32   (4)| 00:00:01 |       |       |
    |   5 |      PARTITION SYSTEM SINGLE           |                              |     2 |    90 |     2   (0)| 00:00:01 |     1 |     1 |
    |*  6 |       TABLE ACCESS BY LOCAL INDEX ROWID| INT_PART_TABLE_PT            |     2 |    90 |     2   (0)| 00:00:01 |     1 |     1 |
    |*  7 |        INDEX SKIP SCAN                 | SYS117585_INT_PART__PIKEY_IX |     3 |       |     1   (0)| 00:00:01 |     1 |     1 |
    |   8 |      COLLECTION ITERATOR PICKLER FETCH | XQSEQUENCEFROMXMLTYPE        |  8168 | 16336 |    29   (0)| 00:00:01 |       |       |
    |*  9 |   TABLE ACCESS BY USER ROWID           | INT_PART_TABLE               |     1 |   130 |     1   (0)| 00:00:01 | ROWID | ROWID |
    Predicate Information (identified by operation id):
       4 - access("SYS_P3"."VALUE"=SYS_XQ_UPKXML2SQL(VALUE(KOKBF$),2,1,0) AND
                  SUBSTRB("VALUE",1,1599)=SUBSTRB(SYS_XQ_UPKXML2SQL(VALUE(KOKBF$),2,1,0),1,1599))
       6 - filter(SYS_XMLI_LOC_ISNODE("SYS_P3"."LOCATOR")=1)
       7 - access("SYS_P3"."PATHID"=HEXTORAW('704E') )
           filter("SYS_P3"."PATHID"=HEXTORAW('704E') )
       9 - filter("ITEM_6"=TBL$OR$IDX$PART$NUM("DEV"."INT_PART_TABLE",0,7,65535,"INT_PART_TABLE".ROWID))
    Note
       - Unoptimized XML construct detected (enable XMLOptimizationCheck for more information)
    SQL> SELECT xml_message
      2  FROM int_part_table
      3  WHERE XMLExists(
      4         '/main[id="144283" or id="9085802"]'
      5         PASSING xml_message
      6       )
      7  ;
    XML_MESSAGE
    <main>
      <id>144283</id>
    </main>
    <main>
      <id>9085802</id>
    </main>
    Execution Plan
    Plan hash value: 3748936130
    | Id  | Operation                                | Name                         | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | SELECT STATEMENT                         |                              |     1 |   155 |    11  (10)| 00:00:01 |       |       |
    |   1 |  NESTED LOOPS                            |                              |     1 |   155 |    11  (10)| 00:00:01 |       |       |
    |   2 |   VIEW                                   | VW_SQ_1                      |     2 |    50 |     8   (0)| 00:00:01 |       |       |
    |   3 |    HASH UNIQUE                           |                              |     2 |   180 |         |             |       |       |
    |   4 |     CONCATENATION                        |                              |       |       |         |             |       |       |
    |   5 |      NESTED LOOPS                        |                              |       |       |         |             |       |       |
    |   6 |       NESTED LOOPS                       |                              |     1 |    90 |     4   (0)| 00:00:01 |       |       |
    |   7 |        PARTITION SYSTEM SINGLE           |                              |     1 |    45 |     2   (0)| 00:00:01 |     1 |     1 |
    |*  8 |         TABLE ACCESS BY LOCAL INDEX ROWID| INT_PART_TABLE_PT            |     1 |    45 |     2   (0)| 00:00:01 |     1 |     1 |
    |*  9 |          INDEX SKIP SCAN                 | SYS117585_INT_PART__PIKEY_IX |     3 |       |     1   (0)| 00:00:01 |     1 |     1 |
    |  10 |        PARTITION SYSTEM SINGLE           |                              |     1 |       |     1   (0)| 00:00:01 |     1 |     1 |
    |* 11 |         INDEX RANGE SCAN                 | SYS117585_INT_PART__PIKEY_IX |     1 |       |     1   (0)| 00:00:01 |     1 |     1 |
    |* 12 |       TABLE ACCESS BY LOCAL INDEX ROWID  | INT_PART_TABLE_PT            |     1 |    45 |     2   (0)| 00:00:01 |     1 |     1 |
    |  13 |      NESTED LOOPS                        |                              |       |       |         |             |       |       |
    |  14 |       NESTED LOOPS                       |                              |     1 |    90 |     4   (0)| 00:00:01 |       |       |
    |  15 |        PARTITION SYSTEM SINGLE           |                              |     1 |    45 |     2   (0)| 00:00:01 |     1 |     1 |
    |* 16 |         TABLE ACCESS BY LOCAL INDEX ROWID| INT_PART_TABLE_PT            |     1 |    45 |     2   (0)| 00:00:01 |     1 |     1 |
    |* 17 |          INDEX SKIP SCAN                 | SYS117585_INT_PART__PIKEY_IX |     3 |       |     1   (0)| 00:00:01 |     1 |     1 |
    |  18 |        PARTITION SYSTEM SINGLE           |                              |     1 |       |     1   (0)| 00:00:01 |     1 |     1 |
    |* 19 |         INDEX RANGE SCAN                 | SYS117585_INT_PART__PIKEY_IX |     1 |       |     1   (0)| 00:00:01 |     1 |     1 |
    |* 20 |       TABLE ACCESS BY LOCAL INDEX ROWID  | INT_PART_TABLE_PT            |     1 |    45 |     2   (0)| 00:00:01 |     1 |     1 |
    |* 21 |   TABLE ACCESS BY USER ROWID             | INT_PART_TABLE               |     1 |   130 |     1   (0)| 00:00:01 | ROWID | ROWID |
    Predicate Information (identified by operation id):
       8 - filter("SYS_P5"."VALUE"='9085802' AND SYS_XMLI_LOC_ISNODE("SYS_P5"."LOCATOR")=1 AND SUBSTRB("VALUE",1,1599)='9085802')
       9 - access("SYS_P5"."PATHID"=HEXTORAW('704E') )
           filter("SYS_P5"."PATHID"=HEXTORAW('704E') )
      11 - access("SYS_P5"."RID"="SYS_P3"."RID" AND "SYS_P3"."PATHID"=HEXTORAW('0BBD')  AND
                  "SYS_P3"."ORDER_KEY"<"SYS_P5"."ORDER_KEY")
           filter(SYS_ORDERKEY_DEPTH("SYS_P3"."ORDER_KEY")+1=SYS_ORDERKEY_DEPTH("SYS_P5"."ORDER_KEY") AND
                  TBL$OR$IDX$PART$NUM("DEV"."INT_PART_TABLE",0,7,65535,"SYS_P3"."RID")=TBL$OR$IDX$PART$NUM("DEV"."INT_PART_TABLE_PT",0,7,65535,ROWI
                  D) AND "SYS_P5"."ORDER_KEY"<SYS_ORDERKEY_MAXCHILD("SYS_P3"."ORDER_KEY"))
      12 - filter(SYS_XMLI_LOC_ISNODE("SYS_P3"."LOCATOR")=1)
      16 - filter("SYS_P5"."VALUE"='144283' AND SYS_XMLI_LOC_ISNODE("SYS_P5"."LOCATOR")=1 AND SUBSTRB("VALUE",1,1599)='144283' AND
                  (LNNVL("SYS_P5"."VALUE"='9085802') OR LNNVL("SYS_P5"."PATHID"=HEXTORAW('704E') ) OR
                  LNNVL(SYS_XMLI_LOC_ISNODE("SYS_P5"."LOCATOR")=1) OR LNNVL(SUBSTRB("VALUE",1,1599)='9085802')))
      17 - access("SYS_P5"."PATHID"=HEXTORAW('704E') )
           filter("SYS_P5"."PATHID"=HEXTORAW('704E') )
      19 - access("SYS_P5"."RID"="SYS_P3"."RID" AND "SYS_P3"."PATHID"=HEXTORAW('0BBD')  AND
                  "SYS_P3"."ORDER_KEY"<"SYS_P5"."ORDER_KEY")
           filter(SYS_ORDERKEY_DEPTH("SYS_P3"."ORDER_KEY")+1=SYS_ORDERKEY_DEPTH("SYS_P5"."ORDER_KEY") AND
                  TBL$OR$IDX$PART$NUM("DEV"."INT_PART_TABLE",0,7,65535,"SYS_P3"."RID")=TBL$OR$IDX$PART$NUM("DEV"."INT_PART_TABLE_PT",0,7,65535,ROWI
                  D) AND "SYS_P5"."ORDER_KEY"<SYS_ORDERKEY_MAXCHILD("SYS_P3"."ORDER_KEY"))
      20 - filter(SYS_XMLI_LOC_ISNODE("SYS_P3"."LOCATOR")=1)
      21 - filter("ITEM_2"=TBL$OR$IDX$PART$NUM("DEV"."INT_PART_TABLE",0,7,65535,"INT_PART_TABLE".ROWID))I asked in one of your other threads if /main/id was unique per XML document.
    If so, you can use a simple function-based index instead of the XMLIndex :
    SQL> drop index int_part_table_uix;
    Index dropped.
    SQL> create index int_part_table_ix1 on int_part_table (
      2    xmlcast(
      3      xmlquery('/main/id' passing XML_MESSAGE returning content)
      4      as varchar2(10)
      5    )
      6  );
    Index created.
    SQL> SELECT xml_message
      2  FROM int_part_table
      3  WHERE XMLCast(
      4          XMLQuery('/main/id' PASSING xml_message RETURNING CONTENT)
      5          AS VARCHAR2(10)
      6        )
      7  IN ('144283', '9085802');
    XML_MESSAGE
    <main>
      <id>144283</id>
    </main>
    <main>
      <id>9085802</id>
    </main>
    Execution Plan
    Plan hash value: 2864653096
    | Id  | Operation                           | Name               | Rows  | Bytes | Cost (%CPU)| Time  | Pstart| Pstop |
    |   0 | SELECT STATEMENT                    |                    |     2 |   236 |     2   (0)| 00:00:01 |       |       |
    |   1 |  INLIST ITERATOR                    |                    |       |       |            |       |  |       |
    |   2 |   TABLE ACCESS BY GLOBAL INDEX ROWID| INT_PART_TABLE     |     2 |   236 |     2   (0)| 00:00:01 |     1 |     1 |
    |*  3 |    INDEX RANGE SCAN                 | INT_PART_TABLE_IX1 |     2 |       |     1   (0)| 00:00:01 |       |       |
    Predicate Information (identified by operation id):
       3 - access(CAST(EXTRACTVALUE(SYS_MAKEXML(0,"SYS_NC00003$"),'/main/id',null,0,0,524293,1073874944) AS
                  varchar2(10)   )='144283' OR CAST(EXTRACTVALUE(SYS_MAKEXML(0,"SYS_NC00003$"),'/main/id',null,0,0,524293,1073874944
                  ) AS varchar2(10)   )='9085802')

  • JNI Invocation: open file in Java, write file in CPP

    Hello,
    Warning: I am a dunce, bad CPP code ahead!
    Using JNI invocation, I am trying to read a binary file in Java and write it in CPP.
    Everything compiles and runs without error, but the input and output jpg files are of course different.
    TIA to any help,
    kirst
    (begin ByteMe.java)
    import java.io.*;
    public class ByteMe
        // Returns the contents of the file in a byte array.
        public byte[] getBytesFromFile(String strInfo) throws IOException
            System.out.println("Testing:" + strInfo);
            File file = new File("1.jpg");
            InputStream is = new FileInputStream(file);
            // Get the size of the file
            long length = file.length();
            // 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;
            // Ensure all the bytes have been read in
            if (offset < bytes.length)
                throw new IOException("Could not completely read file "+file.getName());
            // Close the input stream and return bytes
            is.close();
            return bytes;
        public ByteMe()
              //System.out.println("in constructor");
    }(end ByteMe.java)
    (begin ByteMe.cpp)
    #include <stdlib.h>
    #include <string.h>
    #include <jni.h>
    #include <windows.h>
    // for file operations:
    #include <fstream>
    int main( int argc, char *argv[] )
         JNIEnv *env;
         JavaVM *jvm;
         JavaVMInitArgs vm_args;
         JavaVMOption options[5];
         jint res;
         jclass cls;
         jmethodID mid;
         jstring jstr;
         jobject obj_print;
         options[0].optionString = "-Xms4M";
         options[1].optionString = "-Xmx64M";
         options[2].optionString = "-Xss512K";
         options[3].optionString = "-Xoss400K";
         options[4].optionString = "-Djava.class.path=.";
         vm_args.version = JNI_VERSION_1_4;
         vm_args.options = options;
         vm_args.nOptions = 5;
         vm_args.ignoreUnrecognized = JNI_FALSE;
         // Create the Java VM
         res = JNI_CreateJavaVM(&jvm,(void**)&env,&vm_args);
         if (res < 0)
              printf("Can't create Java VM");
              goto destroy;
         cls = env->FindClass("ByteMe");
         if (cls == 0)
              printf("Can't find ByteMe class");
              goto destroy;
         jmethodID id_construct = env->GetMethodID(cls,"<init>","()V");
         jstr = env->NewStringUTF(" from C++\n");
         obj_print = env->NewObject(cls,id_construct);
         // signature obtained using javap -s -p ByteMe
         mid = env->GetMethodID(cls, "getBytesFromFile", "(Ljava/lang/String;)[B");
         if (mid == 0)
              printf("Can't find ByteMe.getBytesFromFile\n");
              goto destroy;
         else
              jbyteArray jbuf = (jbyteArray) env->CallObjectMethod(obj_print,mid,jstr);
              jlong size = jsize(jbuf);
              printf("size is: %d\n", size); // size shown in output is
              std::ofstream out("data.jpg", std::ios::binary);
              out.write ((const char *)jbuf, 100000);     
         destroy:
             if (env->ExceptionOccurred())
                env->ExceptionDescribe();
        jvm->DestroyJavaVM();
    }(end ByteMe.cpp)

    Hello,
    Me again. Well, not such a dunce after all. Here is code that works correctly, and compiles with no errors and no warnings.
    Will much appreciate help with clean-up code.
    TIA,
    kirst
    (begin ByteMe.java)
    import java.io.*;
    public class ByteMe
        public long getFilezize(String strInfo) throws IOException
              // demonstrates String parameter passed from CPP to Java:
              System.out.println("(getFilesize) Hello world" + strInfo);
              File file = new File("1.bmp");
              InputStream is = new FileInputStream(file);
              // Get the size of the file
              long length = file.length();
              is.close();
              return length;
        // Returns the contents of the file in a byte array.
        public byte[] getBytesFromFile(String strInfo) throws IOException
            System.out.println("(getBytesFromFile) Hello world" + strInfo);
            File file = new File("1.bmp");
            InputStream is = new FileInputStream(file);
            // Get the size of the file
            long length = file.length();
            System.out.println("length is: " + String.valueOf(length));
            // 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;
            // Ensure all the bytes have been read in
            if (offset < bytes.length)
                throw new IOException("Could not completely read file "+ file.getName());
            // Close the input stream and return bytes
            is.close();
            return bytes;
        public ByteMe()
              //System.out.println("in constructor");
    }(end ByteMe.java)
    (begin ByteMe.cpp)
              Signature obtained with command:
                   "C:\Program Files\Java\jdk1.5.0_15\bin\javap.exe" -s -p ByteMe
                   Compiled from "ByteMe.java"
                   public class ByteMe extends java.lang.Object{
                   public long getFilezize(java.lang.String)   throws java.io.IOException;
                     Signature: (Ljava/lang/String;)J
                   public byte[] getBytesFromFile(java.lang.String)   throws java.io.IOException;
                     Signature: (Ljava/lang/String;)[B
                   public ByteMe();
                     Signature: ()V
         Compiled VC++ 2005 Express, run on Vista
    #include <stdlib.h>
    #include <string.h>
    #include <jni.h>
    // file operations
    #include <fstream>
    int main( int argc, char *argv[] )
         JNIEnv *env;
         JavaVM *jvm;
         JavaVMInitArgs vm_args;
         JavaVMOption options[5];
         jint res;
         jclass cls;
         jmethodID mid;
         jmethodID sizeid;
         jstring jstr;
         jobject obj_print;
         jlong filesize;
         options[0].optionString = "-Xms4M";
         options[1].optionString = "-Xmx64M";
         options[2].optionString = "-Xss512K";
         options[3].optionString = "-Xoss400K";
         options[4].optionString = "-Djava.class.path=.";
         vm_args.version = JNI_VERSION_1_4;
         vm_args.options = options;
         vm_args.nOptions = 5;
         vm_args.ignoreUnrecognized = JNI_FALSE;
         // Create the Java VM
         res = JNI_CreateJavaVM(&jvm,(void**)&env,&vm_args);
         if (res < 0)
              printf("Can't create Java VM");
              goto destroy;
         cls = env->FindClass("ByteMe");
         if (cls == 0)
              printf("Can't find ByteMe class");
              goto destroy;
         jmethodID id_construct = env->GetMethodID(cls,"<init>","()V");
         printf("%s\n",id_construct);
         jstr = env->NewStringUTF(" from C++!\n");
         if (jstr == 0)
              // Normally not useful
              printf("Out of memory (could not instantiate new string jstr)\n");
              goto destroy;
         obj_print = env->NewObject(cls,id_construct);
         //BEGIN BLOCK to get file size
         sizeid = env->GetMethodID(cls, "getFilezize", "(Ljava/lang/String;)J");
         if (sizeid == 0)
              printf("Can't find ByteMe.getFilezize\n");
              goto destroy;
         else
              printf("got here\n");
              filesize =(jlong) env->CallObjectMethod(obj_print,sizeid,jstr);
              printf("got filesize\n");
         // END BLOCK to get file size
         // BEGIN BLOCK to write file
         mid = env->GetMethodID(cls, "getBytesFromFile", "(Ljava/lang/String;)[B");
         if (mid == 0)
              printf("Can't find ByteMe.getBytesFromFile\n");
              goto destroy;
         else
              jbyteArray ret =(jbyteArray) env->CallObjectMethod(obj_print,mid,jstr);
              // Access the bytes:
              jbyte *retdata = env->GetByteArrayElements(ret, NULL);
              // write the file
              std::ofstream out("data.bmp", std::ios::binary);
              //out.write ((const char *)retdata, 921654);
              out.write ((const char *)retdata, (long)filesize);
         // END BLOCK to write file
         destroy:
             if (env->ExceptionOccurred())
                env->ExceptionDescribe();
        jvm->DestroyJavaVM();
    }(end ByteMe.cpp)

Maybe you are looking for

  • Built-in Webcam not Recognized by Laptop

    My built-in webcam on my Satellite A305-S6905 is not recognized by my laptop!!!  I click on Camera Assitant Software to boot up the cam and get no where.  The error message reads: Webcam is either disabled or failed. Please check your webcam settings

  • Read specified line from a text file

    Hi, I am trying to read a specific line from a text file. I don't want to read all of it but just this specific line... say line number 2. Is there a method built-in in java or should I code this myself? Thanks and regards, Krt_Malta

  • Interface Variable

    Hi, can somebode explain how succesfully create a bpm block witch Modus ForEach? I have a multipleLine element which collects messages, now i want to send these messages seperate. My idea was to create a block witch Modus ForEach and set the current

  • C Program Hang-Freeze in usleep

    We have a program that intermittantly suffers hang-freezes. Running it in the debugger shows that the C program is calling usleep when it freezes. What kinds of interrupts sent to our application could be causing this? Thanks, Art

  • IHPA is behaving a bit wierd!!!

    Hi Gurus, I hv 1 prbelm. I need 2 extract data from IHPA tab. based upon either d partner funct or d part no. or both. My problem is dat, if user enters part funct on selectn screen, it gives correct records as IHPA tab gives correct records. if user