Help me,, I cannot arrang the position of code

//get hash value for the registering file
byte[] digestBuf = null;
try {
MessageDigest digest1=MessageDigest.getInstance("MD5");
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
byte[] buff = new byte[1024];
int chunk = 1024;
int bytesRead = 0;
while((bytesRead=bis.read(buff, 0, chunk)) != -1) // <-- Notice we don't go into loop at end-of-file
digest1.update(buff, 0, bytesRead);
digestBuf = digest1.digest(); //get hash
catch( Exception ea ){
ea.printStackTrace();
// return digestBuf;
String hexChar = null;
if(digestBuf!= null) {
for(int i=0; i<digestBuf.length; i++) {
     if(digestBuf[i] > 0)
//Convert hex string to two-character string for output
     hexChar = Integer.toHexString(digestBuf);
     else if(digestBuf[i]< 0)
     hexChar = Integer.toHexString(digestBuf[i]).substring(6);
     else
     hexChar = "00";
     //System.out.print(hexChar);
String S = new String();
StringBuffer buffer=new StringBuffer();
S=buffer.append(hexChar).toString();
I want to write the path of file, and filename, and value of S into a.txt. Where Can I put following code.
File filename = new File("E:\\a.txt");
FileOutputStream fos = new FileOutputStream(filename);
DataOutputStream out = new DataOutputStream(fos);
out.writeChars(file.getName());
out.write(S);
out.flush();
out.close();
fos.close();
Can anyone arrange the code for me? Thank you very much

//get hash value for the registering file
  byte[] digestBuf = null;
    try {
      MessageDigest digest1=MessageDigest.getInstance("MD5");
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
      byte[] buff = new byte[1024];
      int chunk = 1024;
      int bytesRead = 0;
      while((bytesRead=bis.read(buff, 0, chunk)) != -1)   // <-- Notice we don't go into loop at end-of-file
      digest1.update(buff, 0, bytesRead);
      digestBuf = digest1.digest(); //get hash
    catch( Exception ea ){
      ea.printStackTrace();
   // return digestBuf;
String hexChar = null;
   if(digestBuf!= null) {
      for(int i=0; i<digestBuf.length; i++) {
     if(digestBuf[i] > 0)
         //Convert hex string to two-character string for output
       hexChar = Integer.toHexString(digestBuf);
     else if(digestBuf[i]< 0)
     hexChar = Integer.toHexString(digestBuf[i]).substring(6);
     else
     hexChar = "00";
     //System.out.print(hexChar);
String S = new String();
StringBuffer buffer=new StringBuffer();
S=buffer.append(hexChar).toString();
jTextArea1.append(S);
//jTextArea1.append(S);
System.out.println();
try{
File filename = new File("E:\\a.txt");
FileOutputStream fos = new FileOutputStream(filename);
DataOutputStream out = new DataOutputStream(fos);
out.writeChars(file.getName());
out.write(S);
out.flush();
out.close();
fos.close();
catch( Exception ea ){
ea.printStackTrace();
It displays ""Frame1.java": Error #: 300 : variable S not found in class fileintegritychecker.Frame1 at line 127, column 11
What is wrong with it?"

Similar Messages

  • HT204291 Help! I cannot see the Airplay symbol on any of my devices anymore!  I have tried following all guides and troubleshooting, but to no avail. Just cannot use the AppleTV with any of my devices.

    Help! I cannot see the Airplay symbol on any of my devices anymore!  I have tried following all guides and troubleshooting, but to no avail. Just cannot use the AppleTV with any of my devices.

    Thanks for the link. It didn't work at first on any of the devices but then I decided to enter a manual DNS instead of an automatic configuration. Then followed the steps again from your link and it worked.
    It is not stable though as I need to reset the device for it to see the airplay. But when it is connected it stays connected for 30 minutes approx.
    Any other suggestions to keep it stable would be fantastic but at least in the meantime I have a workaround.
    Thanks

  • Cannot find the ''Positioning Methods'' option on ...

    Hello....I have recently bought the C7-00 and I wanted to test my GPS but I could not find the "Positioning Methods'' option to select the A-GPS, so can anyone help on this.
    Thank you.

    Do you not have a Location app in your Applications Folder ? As CJ mentioned , that is where you set your location methods to on/off. Inside Location you should have 3 sub folders, Landmarks,GPS data and Positioning. Open Positioning and you should be able to change the settings !
    If I have helped at all, a click on the White Star is always appreciated :
    you can also help others by marking 'accept as solution' 

  • Who can help? BC4J: Cannot find the configuration file bc4j.xcfg

    Wie kan mij helpen?
    Bij het runnen van een BC4J applicatie treedt de volgende fout op, wanneer gedraaid wordt op de 9ias applicatieserver vanuit de gedeployde ear-file, (draai ik de zaak op mijn lokale OC4J dan gaat de zaak wel goed):
    Er is een fout opgetreden JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=JBO-33001: Cannot find the configuration file pilot\common\bc4j.xcfg in the classpath "
    Kijk ik echter in de WEB_INF\classes directory dan bestaat er wel degelijk een pilot\common\bc4j.xcfg file in die directory.
    Het gebeurt bij instantieren van de applicatie-module van BC4J in het volgende code-snippet
    String applicationModule = "pilot.PilotModule"; // Full name of application module
    String configuration = "PilotModuleLocal"; // Name of configuration
    PilotModuleImpl am = (PilotModuleImpl)
    Configuration.createRootApplicationModule(applicationModule,configuration);
    Ik heb Business-components gedecompileerd om te kijken waar de fout optreedt:
    en dit gebeurt in de method loadFromClassPath(String s) in de configuration class
    nadat hij buildConfigurationFileNameFromClassPath de string " pilot\common\bc4j.xcfg "
    heeft opgebouwd. Hij kan de stream dus niet inlezen.
    public void loadFromClassPath(String s)
    throws JboException
    String s1 = "/" + s;
    s1 = s1.replace(File.separatorChar, '/');
    InputStream inputstream = JBOClass.getResourceAsStream(s1);
    if(inputstream == null)
    inputstream = JBOClass.getResourceAsStream(s1.substring(1));
    if(inputstream == null)
    throw new JboException(Class.forName("oracle.jbo.common.CommonMessageBundle"), "33001", new Object[] {
    s1
    try
    loadFromStream(inputstream);
    inputstream.close();
    inputstream = null;
    catch(Exception exception)
    JboException jboexception = new JboException(Class.forName("oracle.jbo.common.CommonMessageBundle"), "33001", new Object[] {
    s
    jboexception.addToDetails(exception);
    throw jboexception;

    I'm having this same problem when I try to run my BC4J project. This has happened to me before but I forgot how it was resolved. Any ideas?

  • Help: why I cannot find the weblogic.mycluster.properties file

    When I first config the cluster. While Setting up the weblogic.properties
              Files, Open and read the cluster properties file (installed by default as
              weblogic/mycluster). Any properties set in the cluster properties file will
              override the same properties that were set from the global properties file.
              But I cannot find this file, Also I copy the weblogic.properties to
              weblogic.mycluster.properties,Also,I cannot find the
              weblogic.cluster.enable=true,etc.
              thanks
              

    It is required to put it in command line.
              Cheers - Wei
              Atish Ray <[email protected]> wrote in message
              news:[email protected]...
              > What happens if I set this property thru the properties file ? It still
              > works. Is there a known problem on this ?
              >
              >
              >
              > Wei Guan wrote in message <[email protected]>...
              > >Yes, the default cluster name is mycluster.
              > >
              > >Create an directory named 'mycluster' under your weblogic home, copy
              > >weblogic.properties to mycluster/weblogic.properties will do the trick.
              > >
              > >weblogic.cluster.enable=true has to be set via command-line. That is, add
              > >'-Dweblogic.cluster.enable=true' in your startup script.
              > >
              > >--
              > >Cheers - Wei
              > >
              > >
              > >
              > >hhb <[email protected]> wrote in message
              > >news:[email protected]...
              > >> When I first config the cluster. While Setting up the
              weblogic.properties
              > >> Files, Open and read the cluster properties file (installed by default
              as
              > >> weblogic/mycluster). Any properties set in the cluster properties file
              > >will
              > >> override the same properties that were set from the global properties
              > >file.
              > >> But I cannot find this file, Also I copy the weblogic.properties to
              > >> weblogic.mycluster.properties,Also,I cannot find the
              > >> weblogic.cluster.enable=true,etc.
              > >>
              > >> thanks
              > >>
              > >>
              > >>
              > >
              > >
              >
              >
              

  • Cannot write the suitable source codes for running program

    I want to write a program that help student to compile program and run program by using some test cases. For the compiled part, i have been wrote it successfully, but for the run part, i cannot pass the test cases to the program for running. Could any ppl help me to find the problem on the followng codes, why the error will on there? how do i change it? Thanks!
    //<!--start get Program Test Case File-->
    java.io.BufferedReader TestCaseBuf = null;
    Connection con = null;
    Statement stmt = null;
    ResultSet rs = null;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection("jdbc:odbc:compas", "sa", "password");
    stmt = con.createStatement();
    String strSQL = "SELECT testValue FROM TEST_CASE WHERE progID='"+progID+"'";
    stmt = con.createStatement();
    rs = stmt.executeQuery(strSQL);
    try
    while (rs.next())
    TestCaseBuf = new java.io.BufferedReader(new java.io.InputStreamReader(rs.getBinaryStream("testValue")));                         
    finally
    if (rs != null)
         rs.close();
    if (stmt != null)
         stmt.close();
    //<!--end get Program Test Case File-->
    //<!--start run program -->
    String[ ] args2 = new String[ ]
         "java", "-cp", System.getProperty("user.dir"), FileName
    try
         Runtime rt = Runtime.getRuntime();
         Process proc = rt.exec(args2);
         java.io.BufferedReader ireader = new java.io.BufferedReader(new java.io.InputStreamReader(proc.getInputStream()));
         java.io.PrintWriter pwriter = new java.io.PrintWriter(proc.getOutputStream());
    String atestcase = null;
         String line= null;
         try
    while ((atestcase = TestCaseBuf.readLine()) != null) <------------I found that error seems on here!!!!
         pwriter.write(atestcase+"\r");
    pwriter.flush();     
    if (atestcase != null)
              if ((line = ireader.readLine()) != null)
              FileOutput = FileOutput + line +"\r\n";
    else {break; }
         } //while
         catch (java.io.IOException e)
         out.println("[IOException]. Printing Stack Trace");
         e.printStackTrace();
         pwriter.close();
         ireader.close();
    catch (java.io.IOException e)
    out.println("[IOException]. Printing Stack Trace");
    e.printStackTrace();
    //<!--end run program -->

    Whats the error message??
    Just a guess, but could be (without seeing the error) that you've already closed the TestCaseBuf reader by closing the result set, hence when you go to read it, you're reading on closed reader.
    Give this a go...Put the //<!--run program --> code into the result set while loop
    while (rs.next())
    TestCaseBuf = new java.io.BufferedReader(new java.io.InputStreamReader(rs.getBinaryStream("testValue")));
    //<!--start run program -->
    ...some code
    //<!--end run program -->
    } Hard to tell without the error message

  • Dbx cannot locate the (DLM) source codes correctly for 64bit app

    It's hard for me to prepare a test case. Because it seems for a simple "hello world" it works.
    The reason I raise this issue here is because my project was recently upgraded to compile with 64bit. And since then dbx cannot locate the source codes correctly, especially for some DLM codes. (sometimes it shows to "/usr/include/iso/..." which it should never be!). While it works fine on a 32bit compiled mode.
    Did anyone experience the similar situation and can share your idea?
    Thanks in advance.

    Can't think of any good reason why going to 64 bit would confuse dbx (except for unknown bug in dbx, which is not impossible).
    I'd first look for changes in your build - for example, 32-bit code used to go to bin/ directory, but 64-bit goes to bin/sparcv9, which happens to be a symlink somewhere else or something like that. Symlinks might sometimes confuse dbx, please read
    (dbx) help finding-filestopic (in dbx console, type "help finding-files").
    Since you are using CC 5.9 that generates DWARF info by default, location and even presence of .o files is not important. All debug info should be in the shared library itself.
    Here's another idea: inspect DWARF info by hand and see if it looks correct to you.
    $ dwarfdump a.out | lessLook for
                    DW_AT_name                  a.ccand
                    DW_AT_comp_dir              /home/maxim/tempThose two should give location of source file (/home/maxim/temp/a.cc in my case). Maybe this will give you some clue.

  • Help!  I cannot get the mouse to work on a pop up on my desk top offering access to imessaging.   Very annoying block to the screen saver.   How do I get rid of it?

    My desktop has a sign offering access to messaging but the mouse does not work on any option.  I cannot log in or give password.   I just want to get rid of it from the desktop.   It is ruining my screensaver.  Please help.

    Robert or Elizabeth...
    Sync media using iTunes, not Bluetooth.
    When the screen freezes on the iPhone, try "resetting".
    Hold the On/Off Sleep/Wake button and the Home button down at the same time for at least ten seconds, until the Apple logo appears.
    And this link is for the iPhone 3GS user guide >  http://manuals.info.apple.com/en_US/iPhone_iOS3.1_User_Guide.pdf
    Main iPhone Support >  Apple - Support - iPhone
    Serously doubt this is a "new" iPhone 3GS. More likely refurbished.

  • HT5654 hello i wander if you could help me i cannot remember the passcod for the ipad ive tried restoring the ipad but because the ipad needs a software update i cant do it!!!!

    Hi i am unable to remember the passcode for our ipad can u help please

    Forgotten passcode or device disabled after entering wrong passcode

  • Help!  I cannot download the new book that I bought @ iTunes!!!

    I recently bought a newly released first issue book to download to my iPad.  As I was downloading the book it stopped.  The book shows up in my iBooks "library" as well as under "purchased".  The icon for it is there, but does nothing when I try and download it.  If I try and buy it again, it won't allow me.  It just shows the book cover and a cloud with arrow pointing down.  I have clicked on it and it just acts like it is downloading but then nothing happens.  I even upgraded my cloud storage capacity to the largest memory size and I am only using about 1/3 of the total.
    Any help/ideas are appreciated!!!
    Thanks!

    Hello Crafool,
    Thank you for contacting Apple Support Communities. You can take a look at this article. It provides information on downloading previous purchases. You might check the instructions to make sure you are doing all the steps. There are additional links for additional troubleshooting or proper contacts if the download fails.
    Download past purchases
    http://support.apple.com/kb/HT2519
    Regards,
    Jeff D.

  • [HELP] Amazon Kindles Cannot See the Amazon Server...

    Yesterday both of our Amazon Kindles lost the ability to download books from our archieve library.  Both are showing that they are connected to the Internet but when I sync them nothing happens.  We contacted Amazon and they sent out a new Kindle to us but this one also fails to download any books.
    I then downloaded the Kindle for Andriod app and attempted to get the books again the same result.  I then turn off my WiFi on my phone and tried again.  This time my archieve library appeared.  So it worked via O2 Mobile Network.  I then set my HTC Desire up as a Hotspot and connected the original Kindle to it via WiFi and it worked.  The Archieved Books list updated with all the books.
    So it appears there is an issue with BT accessing Amazon Kindle servers.  Note all PC's and Laptops successfully connect to the Internet via BT BB.
    Looking at my router logs the Kindles are trying to access two servers:
    dogvgb9ujhybx.cloudfront.net
    cde-g7g.amazon.com
    When I ping these cde-g7g.amazon.com times out.
    Any ideas?
    Amazon are due to ring back any minute to see if the problem has been resolved by the new Kindle.  I think the problem is a BT BB one though!
    Chris.
    Solved!
    Go to Solution.

    Sounds like to me it's a Amazon Server problem.  They rang me back and I explained how it worked via O2 mobile network.  He then moved the new Kindle on to my Amazon account and told me to go get a free book.  I then sync'd the Kindle and it stayed on my dad's Amazon account.  It should have moved to mine which means it did not connect to their server.  However Kindles have an Experimental area with a web browser on it.  I was asked to browse to Amazon's website and that worked!
    They still cannot download any books though!!!
    They asked me to contact BT to see if there was a problem with the them.  BT told me if there was an issue with the DNS servers I would not be able to connect to any websites so it must be Amazon!
    The only thing I am going to try is to set up the Home Hub and see if they connect via that,  it was working fine via my Vigor 2800 though so I don't think its going to make a difference.
    Chris.

  • HELP! I cannot download the desktop software.

    I've tried using both IE and Chrome browsers. I've tried downloading different versions.   I've tried turning off my firewall temporarily.  I keep getting error message that link is broken.
    What am I doing wrong and why can't I download?
    Thanks for any help on this.  Been trying for over a week now. 

    If you try from another location does it work? Like from your job? Not sure what else to try honestly that would be preventing you downloading the software at your house. Did you contact your ISP about it?
    If someone has been helpful please consider giving them kudos by clicking the star to the left of their post.
    Remember to resolve your thread by clicking Accepted Solution.

  • PLZ HELP: Error is Cannot load the driver

    I dont know where i am going wrong : Just i am getting the blank page
    i am posting my code :
    --------------------LoginServlet4.java
      package com.xyz;
      import java.io.*;
      import java.util.*;
      import javax.servlet.*;
      import javax.servlet.http.*;
      import java.sql.*;
      public class LoginServlet4 extends HttpServlet
           public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
              try{
           User4 user=new User4();
           UserServices4 userServices4= new UserServices4();
           ArrayList userList = (ArrayList)userServices4.listUser4();
           req.setAttribute("userList",userList);
          RequestDispatcher rd = req.getRequestDispatcher("form5.jsp");
           rd.forward(req,res);
                }//try
                catch(Exception e)
                   System.out.println(e);
                }//catch
             }//doGet
    }---------------------UserServices4.java
    a bussiness logic class where i am opening the connection and retrieving the data
    package com.xyz;
    import java.io.*;
    import java.io.Serializable;
    import java.util.*;
    import java.sql.*;
    public class UserServices4
          public UserServices4(){}
          Connection con=null;
          PreparedStatement ps=null;
          ResultSet rs=null;
          public List listUser4(){
         ArrayList userList = new ArrayList();
         User4 user=null;
         String s1,s2,s3,s4;
          try
               Class.forName("com.jdbc.mysql.Driver");
                con=DriverManager.getConnection("jdbc:mysql://165.138.99.765/Bidding","mysql","mmmmm");
                ps=con.prepareStatement("select * from Match_Set");
                rs=ps.executeQuery();
                while(rs.next())
                   s1=rs.getString(1);
                   s2=rs.getString(2);
                   s3=rs.getString(3);
                   s4=rs.getString(4);
                   user = new User4();
                   user.setT1(s1);
                   user.setT2(s2);
                   user.setO1(s3);
                   user.setO1(s4);
                   userList.add(user);
          }//try
          catch(Exception e)
               System.out.println(e);
          finally{
               try{
                    con.close();
                    catch(Exception e)
          }//finally
          return userList;
    }/userList
    }//userservices4--------------------------User4.java ( A bean Class )
    package com.xyz;
    import java.io.*;
    import java.util.*;
    public class User4
         public User4(){}
              public void setT1(String s)
                    T1=s;
               public String getT1()
                    return T1;
               public void setT2(String s)
                    T2=s;
               public String getT2()
                    return T2;
               public void setO1(String s)
                         O1=s;
                    public String getO1()
                         return O1;
               public void setO2(String s)
                          O2=s;
                     public String getO2()
                          return O2;
           private String T1,T2;
           private String O1,O2;
    }-----------------------------form5.jsp
    <%@ page import= "java.io.* "%>
    <%@ page import= "java.sql.*" %>
    <%@ page import= "java.util.*" %>
    <%@ page import= "javax.servlet.http.*" %>
    <%
    ArrayList userList = (ArrayList)request.getAttribute("userList");
    out.println(userList);
    %>=============================
    PLZ HELP ME

    thanks for pointing the error i had made,
    But this output i got..
    [com.pennywise.User4@c0a9f9, com.pennywise.User4@d72200, com.pennywise.User4@1f9338f, com.pennywise.User4@1a80aea, com.pennywise.User4@164b9b6, com.pennywise.User4@1dc64a5, com.pennywise.User4@53c3f5, com.pennywise.User4@166340c, com.pennywise.User4@e33e18, com.pennywise.User4@101ac93, com.pennywise.User4@e90943, com.pennywise.User4@15f1f9c, com.pennywise.User4@1474ea, com.pennywise.User4@107bd0d, com.pennywise.User4@10ca208, com.pennywise.User4@61f533]

  • Blackberry z10 help | My Mac cannot recognize the phone and my phone stuck at booting %99 for 6 hours nothing happened

    My Blackberry z10 , Stuck at %99 Boot , and my Mac OSX doesn't recognize it?. i have latest Blackberry Link Version

    The funniest part of the whole situation, Apple Care explained it to me as some kind of feature. The told me how to adjust the time when my computer sleeps and recommend I don't shut it down, let it sleep and "instant wake". I would bet if you called them about your Macbook, they would suggest you just close the lid and let it sleep rather than shutting it down.
    Basically shutdown and restart have a problem and the solution is to not shutdown is how they explained it to me. They kept saying buzz words like "instant on" and "fast wakeup". My computer already could sleep and wakeup fast, but now shutdown and restart don't work right. I called them 3 times about it, but since they use these buzzwords, sounds like Lion is meant for a Macbook Air or a Mac with an SSD. If you have a normal hard disk, some of the saving/versions/resume features take too long to be written to the disk on shutdown. And when you start again, it takes a long time to reload the system to it's previous point.
    Even if I uncheck the box to reopen windows on next start, it reopens them anyways.
    If they can't give me a better explaination or some kind of fix, I will have to go back to Snow Leopard. I use my Mac in a production environment and depend on stability. They assured me before I upgraded that it would be stable and all the new saving and versions features could help my productivity. So far it's not helping me and downright annoying. You need to close all your windows before you close the program... if you have 5 windows open in terminal or textedit... every time you launch, they will launch all those windows. I just really want versions, not resume it seems.
    But I can deal with it opening a million windows, just can't take it getting stuck on booting or not shutting down properly. This is a "feature" that should be fixed. LOL

  • 11G ADF BC: How to arrange the position of items in a query scenario?

    Hi,
    I am creating a search page with a search scenario at the top and a result table at the bottom using Jdev 11G (11.0.0.0.1) ADF BC. In my search scenario, there are about 35 items. Now they are evenly divided in 3 columns by default. I have certain requeirement for the layout of the these items. But seems to me, they are not editable to the programmer. Does anyone know anything about this? Any idea is deeply appraciated.
    Regards,
    Annie

    Timo,
    Thank you for your reply and I am sorry that I did not say it clearly.
    Yes, I use the "All Querable Attributes" under " "Named Criteria" under the "Data Control" Palette. So I do not think I have any control over those items in the query scenario under the "Structure" pane. They are completely hidden for me. Do you know any other ways to modify them? I mean to change the layout of them.
    Regards,
    Annie

Maybe you are looking for