Please Help its urgent........requirement is to read a .gz file

and to randomly acces it...
If i read the file line by line using GZIPInputStream it takes lot of time...
My requirement is to pick some line (say 35000) randomly......
Please suggest any alternative.....

use this code to unzip a .gzip file:
try {
        // Open the compressed file
        String inFilename = "infile.gzip";
        GZIPInputStream in = new GZIPInputStream(new FileInputStream(inFilename));
        // Open the output file
        String outFilename = "outfile";
        OutputStream out = new FileOutputStream(outFilename);
        // Transfer bytes from the compressed file to the output file
        byte[] buf = new byte[1024];
        int len;
        while ((len = in.read(buf)) > 0) {
            out.write(buf, 0, len);
        // Close the file and stream
        in.close();
        out.close();
    } catch (IOException e) {
    }

Similar Messages

  • Sql  Query . Please help its urgent.

    Suppose in table EMP there are 2 columns (Roll_no and Name)
    Roll NO Name
    00001 A
    00002 B
    00010 X
    My requirement is to trunc preceding Zero's. For ex : for Roll no: 00001 the output should be 1 and for 00002 --> 2 .
    Please help its very urgent.

    try this
          select
                  to_number(roll_no) roll_no,
                  name
          from
                  emp;
         Regards
    Singh

  • Please Help its Urgent ***POPUP at the time of MIGO Posting*****

    Hi all,
    Please help me on this issue,
    I want to display one popup at the time of migo posting and that popup ask to user that " How much labels you wants to print?" and in next of that i want one text box or input field in that user inputs the number of labels he wants to print.
    I have tried using various POPUP functions but i have not got any FM which fulfill my requirement so please help me on this issue?
    Kind Regards
    Sudarshan Gaikwad

    The standart POPUP* function modules seem to either give an option to output descriptive text, or ask for a dictionary based field as an input.  As you want both in one popup you may need to write your own custom pop-up.
    Create a function group with a Z function module and add a dialog screen with the required text and input field to this function group.
    Take a look at function POPUP_GET_VALUES as an example - A custom written one could be a lot simpler.
    Then call this function from your user exit.
    Andrew

  • Iphone 5 troubles, please help, its urgent!

    I got this new iphone 5, but i wanted my music and photos to go on it from my ipod 4th generation, so i connected my ipod to my computer and itunes and backed it up, when i plugged in my iphone, its said to back it up (hoping my files would transfer like it intended it would, i did so) .. except it turned my iphone 5 into an ipod, they layout was the same, the settings were the same, please i need help and i want to see my iphone back to the way i had it when i got it earlier today. I've tried all the resets and it still won't work

    Download the ipsw for your iphone, then open itunes and press shift (on windows) or option (on Mac), while holding that button click on restore, then you can selecte where to restore from, select the file you just downloaded, make sure is the latest version, and check if your phone is CDMA or GSM before downloading the file.
    You might be able to find the ispw on google

  • PLEASE HELP ITS URGENT (PROBLEM IN INCLUDE)

    IF I EXECUTE IN 4.6C ITS NOT GIVIN NY ERROR BUT THE SAME CODE IN 6.0 IS GIVING ERROR
    IF NOT ( ( text_flag = 'X' AND tcode_level > 0 ) OR
                 ( text_flag_level0 = 'X' AND
                   tcode_level      = 0   AND          )    ).
    ERROR IS:
    Incorrect logical expression: "AND" or "OR" must be preceded by an          
    expression (e.g. a comparison).          
    PLZ HELP ME AS IT IS VERY URGENT.
    THANX IN ADVANCE

    Hi anit,
    1. minor mistake
    2. remove this AND in bold.
    IF NOT ( ( text_flag = 'X' AND tcode_level > 0 ) OR
    ( text_flag_level0 = 'X' AND
    tcode_level = 0 <b>AND</b> ) ).
    regards,
    amit m.

  • Problem with client side printing, please help its urgent

    hi ,
    am using struts and jasper reports on my project, now i was having problem that whenever i try to print the report , the printer dialogue box was appearing on server machine, i want it on client end, how to solve this problem, please any one know help me, it was urgent,
    my code was like this
    JasperCompileManager.compileReportToFile("c:/report/test.jrxml","c:/report/test.jasper");
    JasperPrint jasperPrint = JasperFillManager.fillReport("c:/report/test.jasper"),parameters,con);
    List l=jasperPrint.getPages();                         
    if(l.size() != 0){
      jasperPrint.setOrientation(JasperReport.ORIENTATION_PORTRAIT);
      jasperPrint.setPageHeight(877);
      jasperPrint.setPageWidth(963);
      JasperPrintManager.printPages(jasperPrint,0,l.size()-1,true);
    }thanks in advance,

    Double post.

  • RegEx Error for Huge File .. Please help , Its Urgent

    Hi all,
    I am getting following exception,
    does anyone know about it
    java.lang.IndexOutOfBoundsException: No group 1
    at java.util.regex.Matcher.group(Matcher.java:355)
    at java.util.regex.Matcher.appendReplacement(Matcher.java:585)
    at java.util.regex.Matcher.replaceFirst(Matcher.java:701)
    at XSLT_OnlyJava.<init>(XSLT_OnlyJava.java:84)
    at XSLT_OnlyJava.main(XSLT_OnlyJava.java:93)
    Exception in thread "main"
    I am parsing huge file with regex and replacing some part
    Thanks,
    Vinayak

    sorry for late
    This is my code
    text = contents.toString();
              String regex = "<tu.*?/tu>";
              Matcher matcher = Pattern.compile(regex,Pattern.CASE_INSENSITIVE|Pattern.DOTALL).matcher(text);
              while(matcher.find()){
                   tuvSegment = matcher.group();
                   String segRegex = "<seg>.*?</seg>";
                   Matcher segMatcher = Pattern.compile(segRegex,Pattern.CASE_INSENSITIVE|Pattern.DOTALL).matcher(tuvSegment);
                   if(segMatcher.find()){
                        SegVal = segMatcher.group();
                   String ReplsegRegex = "<seg />";
                   Matcher ReplsegMatcher = Pattern.compile(ReplsegRegex,Pattern.CASE_INSENSITIVE|Pattern.DOTALL).matcher(tuvSegment);
                   text = ReplsegMatcher.replaceFirst(SegVal);
    The text string contains teh .tmx file
    Thanks,
    Vinayak

  • Lsmw issue plz help its urgent

    Hi Experts ,
    i need to create a LSMW using batch input .
    but the requirement is on the basis of conditions my recording need to be changed .
    dat means
    3127POL09 3127POL09-1 CTR 3127-1003E 100 FUL
    3127POL09 3127POL09-2 WBS 3127POL01 60 FUL
    for ctr i ill have to post data in screen number 200
    and for wbs i ill have to post data in screen number 400 .
    can we put some conditions in recording in lsmw ?
    i no we can create multiple recording but how can we use them to fullfill my requirement .
    plz help its urgent
    thanx in advance

    Hi,
    Within LSMW, there is an option to write our own code wherein this code can be incorporated.
    This is in the Field Mapping Option...
    Just go to the Menu Extras->Layout
    and click on the check box Form Routines
    Global Data.
    Here you can define Global Variables and also perform your ABAP Coding.
    Regards,
    Balaji.

  • I made upgrade for IOS to 7.04 but my iphone is second hand and when iphone need to make activation ,i don't have the apple ID so my iphone didn't work from this time so please help me urgent

    I made upgrade for IOS to 7.04 but my iphone is second hand and when iphone need to make activation ,i don't have the apple ID so my iphone didn't work from this time so please help me urgent.

    There isn't one.
    amrzaky wrote:
    I can't contact with previous owner s i need another solutoin
    The Apple ID and Password that was Originally used to Activate the iDevice is required.
    If you cannot get this information from the seller
    Removing a device from a previous owner’s account
    You need to return the Device for a refund, as you will not be able to re-activate it.

  • Help - i recently made put together a high quality movie for a relative, it has taken me months to complete and it goes for a total of 9 hours and 43 minutes ,however, it won't let me export the video at all! please help - its taken ages to make it!

    Help - i recently made put together a high quality movie for a relative, it has taken me months to complete and it goes for a total of 9 hours and 43 minutes ,however, it won't let me export the video at all! please help - its taken ages to make it!

    9 hours??!
    Twice the length of a cinema epic?
    How are you expecting to distribute it?
    iDVD encoding settings:
    http://docs.info.apple.com/article.html?path=iDVD/7.0/en/11417.html
    Short version:
    Best Performance is for videos of up to 60 minutes
    Best Quality is for videos of up to 120 minutes
    Professional Quality is also for up to 120 minutes but even higher quality (and takes much longer)
    That was for single-layer DVDs. Double these numbers for dual-layer DVDs.
    Professional Quality: The Professional Quality option uses advanced technology to encode your video, resulting in the best quality of video possible on your burned DVD. You can select this option regardless of your project’s duration (up to 2 hours of video for a single-layer disc and 4 hours for a double-layer disc). Because Professional Quality encoding is time-consuming (requiring about twice as much time to encode a project as the High Quality option, for example) choose it only if you are not concerned abo
    In both cases the maximum length includes titles, transitions and effects etc. Allow about 15 minutes for these.
    You can use the amount of video in your project as a rough determination of which method to choose. If your project has an hour or less of video (for a single-layer disc), choose Best Performance. If it has between 1 and 2 hours of video (for a single-layer disc), choose High Quality. If you want the best possible encoding quality for projects that are up to 2 hours (for a single-layer disc), choose Professional Quality. This option takes about twice as long as the High Quality option, so select it only if time is not an issue for you.
    Use the Capacity meter in the Project Info window (choose Project > Project Info) to determine how many minutes of video your project contains.
    NOTE: With the Best Performance setting, you can turn background encoding off by choosing Advanced > “Encode in Background.” The checkmark is removed to show it’s no longer selected. Turning off background encoding can help performance if your system seems sluggish.
    And whilst checking these settings in iDVD Preferences, make sure that the settings for NTSC/PAL and DV/DV Widescreen are also what you want.
    http://support.apple.com/kb/HT1502?viewlocale=en_US

  • Javafx deployment in html page(please help me urgent)

    i used the following method to deploy javafx in an html page.
    javafx file is:
    package hello;
    import javafx.scene.*;
    import javafx.stage.Stage;
    import javafx.scene.text.Text;
    import javafx.scene.text.Font;
    import javafx.scene.paint.Color;
    import javafx.scene.effect.DropShadow;
    Stage {
        title: "My Applet"
        width: 250
        height: 80
        scene: Scene {
            content: Text {
                x: 10  y: 30
                font: Font {
                     size: 24 }
                fill: Color.BLUE
                effect: DropShadow{ offsetX: 3 offsetY: 3}
                content: "VAARTA"
    I save the file as HelloApplet in a 'hello' named folder in my D:
    after that i downloaded from internet html code as
    <html>
        <head>
            <title>Wiki</title>
        </head>
        <body>
            <h1>Wiki</h1>
            <script src="dtfx.js"></script>
            <script>
                javafx(
                    archive: "HelloApplet.jar",
                    draggable: true,
                    width: 150,
                    height: 100,
                    code: "hello.HelloApplet",
                    name: "Wiki"
            </script>
        </body>
    </html>now i typed in DOS prompt as javafxc.exe HelloApplet.fx & i got the class files .
    _The main problem which is coming is how to create HelloApplet.jar file which is used in the html page without which the html page is not displaying the javafx script. Please help me urgently i am in the middle of my project & stuck up due to JAVAFX                   i am using WIndowsXP & javafx-sdk1.0 when i am typing jar command inside hello package it is displaying invalid command.in DOS prompt. If there is any other method to deploy javafx in html page then specify it also.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Crossposted: [http://forums.sun.com/thread.jspa?threadID=5323288].
    Please don't crosspost without notifying others. It is rude in terms of netiquette. Stick to one topic.

  • How to enable java script in my Firefox browser? help its urgent.

    how to enable java script in my Firefox browser? help its urgent.

    go to '''about:config''' and search for '''javascript.enabled''' change its value to '''true'''
    *[http://kb.mozillazine.org/About:config about:config]

  • Have tried to restore settings due to problems, now Iphone shows Sim Failure, how can I get back to using my phone? Please help, its a business phone. :(

    Hi, I have tried to restore settings on my Iphone due to problems I was having with the phone cutting out when talking on the phone, now Iphone shows Sim Failure, how can I get back to using my phone? Please help, its a business phone.

    Hi jclarke64, 
    Thank you for contributing to the Apple Support Communities. 
    I'm sorry to hear that your iPhone 4s was lost, and glad that you were able to upgrade. 
    If your iPhone 4s was backed up to iCloud or using iTunes, you can restore the backed up data to your new phone. 
    See the steps in this article for help with restoring from a backup:
    Back up and restore your iPhone, iPad, or iPod touch using iCloud or iTunes - Apple Support
    All the best,
    Jeremy 

  • Failed to initialize the orb--please reply its urgent

    hi im using a stand alone java application to access a jndi data source configured on websphere 6.1
    im getting the following error
    failed to initialize the ORB...
    most of the solutions i got suggest to change from sun jdk to ibm jdk.BUT BUT how do we do that and what are the steps to be followed.
    he code im using is given below:
    //WebsphereJNDI.java
    import java.sql.*;
    import java.util.*;
    import javax.sql.*;
    import javax.naming.*;
    import javax.rmi.*;
    public class WebSphereJNDI
    private String websphere_server;
    private String jndi_datasource;
    private String sql_query;
    WebSphereJNDI(String serverpath, String jndiname, String query)
    websphere_server = serverpath;
    jndi_datasource = jndiname;
    sql_query = query;
    public ResultSet get_data() throws Exception
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
    env.put(Context.PROVIDER_URL, websphere_server);
    InitialContext ctx = new InitialContext(env);
    DataSource ds = (DataSource) ctx.lookup(jndi_datasource);
    Connection conn = ds.getConnection();
    Statement stm = conn.createStatement();
    ResultSet res = stm.executeQuery(sql_query);
    // moving cursor to first row
    res.next();
    return res;
    // ResultSetTester.java
    import java.sql.*;
    import java.util.*;
    import javax.sql.*;
    import javax.naming.*;
    import javax.rmi.*;
    public class ResultSetTester {
    public static void main(String[] args) throws Exception {
    WebSphereJNDI test = new WebSphereJNDI(
    "http://hostname:port no.", "jdbc/mydatasource",
    "SELECT * FROM pubs.dbo.authors");
    System.out.println(dump_data(test.get_data()));
    public static String dump_data(java.sql.ResultSet rs)
    throws Exception {
    int rowCount = 0;
    String result = "";
    result += "<P ALIGN='center'><TABLE BORDER=1>";
    ResultSetMetaData rsmd = rs.getMetaData();
    int columnCount = rsmd.getColumnCount();
    // table header
    result += "<TR>";
    for (int i = 0; i < columnCount; i++) {
    result += "<TH>" +
    rsmd.getColumnLabel(i + 1) + "</TH>";
    result += "</TR>";
    // the data
    while (rs.next()) {
    rowCount++;
    result += "<TR>";
    for (int i = 0; i < columnCount; i++) {
    result += "<TD>" +
    rs.getString(i + 1) + "</TD>";
    result += "</TR>";
    result += "</TABLE></P>";
    return result;
    Im an amateur...Please help its urgent

    Thanks Anuj.
    We use OSB apps (exported as jars only).
    We place the jars in domain/lib to be available for all services in this domain.
    Is there another place we can put our jars in it?? and how can we solve the problem of soa infra with using Spring 3.2 ??
    Thanks in advance.

  • Please reply its urgent

    it is only wokring when i only assign value to sub1 variableassign
    <html>
    <body>
    <%@ page language="java" import="java.sql.*" %>
    <%
    String[] list=request.getParameterValues("list");
    // String list=request.getParameter("list");
    int i;
    String sub1;
    for(i=0;i<list.length;i++)
    try
    sub1=list;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:dsn1","","");
    Statement stmt=con.createStatement();
    stmt.execute("delete from mes where sub='"+sub1+"'");
    out.println(sub1);
    stmt.close();
    con.close();
    catch(Exception e)
    {out.println(e);}
    %>
    Click here
    </body>
    </html>

    Doublepost: http://forum.java.sun.com/thread.jspa?threadID=5192841
    Crosspost: http://forum.java.sun.com/thread.jspa?threadID=5192927
    Like I said in your former topic: just debug it. Run the debugger or put some simple System.out.println() lines to check if the array has a length, if the array elements are not null, if the final SQL statement is correct, etcetera.
    By the way, with putting pressure by shouting "please reply its urgent" you don't gain that much respect from our side. Some will refuse to reply. Urgency is your issue, not ours.

Maybe you are looking for