How can i read a file into my program?

Hi,
I have a text file that I want to read in to the program and for it to print on the screen. I have the following code but it doesn't seem to work as it doesn't print anything to the screen although i get no errors. If anyone could correct me or elp me that would be great. Thanks in advance.
public static void fileInput () throws IOException
final FileReader inputFile = new FileReader("Database.txt");
final BufferedReader inputBuffer = new BufferedReader(inputFile);
String line = inputBuffer.readLine();
}

Java programmers who think that variables are subject
to garbage collection should not go around calling
themselves professionals. It's objects that
are garbage collected.I agree,
have you had a look to the "varibales" that i'm "nulling" in my code?
What do you think, following "varibales" i declared, inherits from?
FileInputStream
DataInputStream
StringOf course all of them inherits from java.lang.object - So they are objects...
The only real flat "variable" i declared is a byte array and i agree that there's no need to "null" it. It's just "consuetude".
And additional:
To make the memory management complete there has to be a finalize() method at the end of your class to remove all of your OBJECTS from memory...
We're programming a real high performance WebApplication using CORBA, Servlets, AJAX and Database Connections which handles up to 5 Million
Datasets (using Hashes, Lists and so on) with just a simple click in this app and running at least 4 (up to unlimited spanned over different machines) Java Runtimes (CORBA Servers) which have different jobs AND will run (ok, should) 24h a day, 7 days a week and 365 days a year.
In such an app (about 500.000 lines of code in the moment) you WILL recognize if you "null" an object and finalize it! If you won't do that they will "eat" your memory until you get an "OutOfMemory" error.

Similar Messages

  • How can I read a file with ASCII Special Character into a SQL table using SSIS 2008?

    I've tried everything to read this file and am getting no where.   Help how can I read this file and load a SQL table?
    RS - AscII - 30  (Record Separator)
    GS - AscII - 29 (Group Separator)
    Thank you for your assistance - Covi
    Mark Covian

    We can use script component as source/transformation to read the text file and assign the contains to a string. Split the string by chr(30)  i.e RS and finally stored into an array or write to the output buffer of the script component.
    For example on how to use script component refer this link
    http://social.technet.microsoft.com/Forums/en-US/6ff2007d-d246-4107-b77c-624781baab38/how-to-use-substring-in-derived-column-in-ssis?forum=sqlintegrationservices
    Regards, RSingh

  • I shot video on a Panasonic P2 and I'm trying to import the MXF files to Final Cut Pro but when I try to import, the only thing that imports is a blurry image of each clip. There's no audio and no video...how can I import MXF files into Final Cut Pro?

    I shot video on a Panasonic P2 and I'm trying to import the MXF files to Final Cut Pro but when I try to import, the only thing that imports is a blurry image of each clip. There's no audio and no video...how can I import MXF files into Final Cut Pro?

    at the end, you say "import preferences", which program are you describing?
    So im safer using footage that is remotely being pulled from iphoto...
    vs
    using footage that is imported into FCP from imovie?
    Is there anything i can do in fcp to make this footage more reliable or safer or more stable as i pull remotely from iphoto?
    All the footage, and all the libraries to all programs, or on a new pegasus 12tb raid 5 setup fyi.

  • How can I sync text files into iPhone?

    How can I sync text files into iPhone? like doc. txt. for reading or editing

    The native iPhone OS doesn't allow that. I think there are several solutions to this, some of which may be against the AT&T or Apple rules. One legitimate solution is The Missing Sync for iPhone by mark/space (http://www.markspace.com).
    Before I had an iPhone, I owned a copy of The Missing Sync for Windows Mobile. It was a pretty decent app. In my opinion, though, their app for the iPhone is NOT worth the price ($40 new, $25 for a cross-grade).
    Also, check the App Store (if you have 2.0 software)--there may be an app that does this, probably for a lot less $.

  • How can i import mpeg files into iMovie?

    how can i import mpeg files into iMovie?

    Where are your MPEG stored?
    I have hundreds of old MPEGs stored in my nexternal drive, but unfortunatly i was not able import them into iMovie. I did the following trick: I created a new set of a folder and subfolder and called it "Virtual_CAM/DCIM" and saved it on my desktop. Then went to Disk Utilities>File Menue>New>Disk Image from Folder. Then selected the folder on my desktop and clicked enter. I moved the .dmg file to my external (or just keep it on your desktop). I clicked on the .dmg file. It shoud be visible on the Finder. Open your Imovie and import as you do from your camera.

  • How can I read a file directly please?

    Hello everyone,
    How can I read a file directly from a script please? I tried the insert into ... values but it does not work. I really have to read the file instead of entering the data via the interface. Does Oracle have a copy command? Each file line is split with tabs for each field in the line.
    Finally how can I subdivide the strings in each field?
    Thank you very much indeed and sorry for the basic questions.
    André Luiz

    SQL> create or replace directory data_dir as '/tmp';or
    SQL> create or replace directory data_dir as 'c:\temp';Where /tmp or c:\temp are directories or folders on the server.
    A full example of importing a tab delimited file is here.
    Re: Using DML order to import a .xls file

  • How can I read pdf files from LabVIEW with different versions of Acrobat reader?

    How can I read pdf files from LabVIEW with different versions of Acrobat reader?
    I have made a LabVIEW program where I have possibility to read a PDF document.  When I made this LabVIEW program it was Acrobat Reader 5.0.5 that was installed on the PC. Lather when the Acrobat Reader was upgraded to version 6.0, there was an error when VI tries to launch the LabVIEW program. And Later again when we upgraded to Acrobat Reader 7.0.5 I must again do some changes and rebuild the EXE files again
    It isn't so very big job to do the changes in one single LabVIEW program, but we have built a lot of LabVIEW programs so this take time to due changes every time vi update Acrobat Reader. (We have build EXE files.)
    The job is to right click the ActiveX container and Click "Insert ActiveX Object", then I can brows the computer for the new version of acrobat Reader. After this I must rebuild all the "methods" in the Activex call to make the VI executable again.
    Is there a way to build LabVIEW program so I don't have to do this job every time we update Acrobat Reader?
    This LabVIEW program is written in LabVIEW 6.1, but I se the problem is the same in LabVIEW 8.2.
    Jan Inge Gustavsen
    Attachments:
    Show PDF-file - Adobe Reader 7-0-5 - LV61.vi ‏43 KB
    Read PDF file.jpg ‏201 KB
    Show PDF-file - Adobe Reader 5-0-5 - LV61.vi ‏42 KB

    hi there
    try the vi
    ..vi.lib\platform\browser.llb\Open Acrobat Document.vi
    it uses DDE or the command line to run an external application (e.g. Adobe Acrobat)
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"

  • How can I read text files from LAN if I only know the hostname?

    I'm new in Java Developing, and dont know the written classes yet. I need help, how to do the following steps?
    <p>1. How can I read text files from LAN if I only know the hostname, or IP address?
    <p>2. How to read lines from text files without read all lines from the beginning of file, just seek to a position.
    (ex. how can I read the 120th line?)
    <p>Please help!
    <p>sorry for the bad english

    I'm new in Java Developing, and dont know the written classes yet. I need help, how to do the following steps?
    1. How can I read text files from LAN if I only know the hostname, or IP address?You need to know the URL of the file. You need to know the hostname, port, protocl and relative path.
    The hostname is server, not file.
    2. How to read lines from text files without read all lines from the beginning of file, just seek to a position.Use the seek() to get to a random byte.
    (ex. how can I read the 120th line?)The only way to find the 120th line is to read the first 120 lines. You can use other file formats to find the 120th line without reading the whole file but to need to be able to detremine where the 120th line is

  • How can I import vob files into imovie 09?

    how can I import vob files into imovie 09? i have some home movies on dvd that i want to edit.

    You might want to look at this one too.  Very easy to use and it doesn't require the Apple MPEG-2 playback component.
    http://www.dvdxdv.com/NewFolderLookSite/Products/DVDxDV.overview.htm

  • How can I import .mts files into Final Cut Studio from my Sony High Def Camcorder

    How can I import .mts files from my Sony High Def camcorder into Final Cut Studio?

    Also see: https://discussions.apple.com/community/professional_applications/search.jspa?pe opleEnabled=true&userID=&containerType=&container=&spotlight=true&q=.mts

  • How can I read a file in a jar file and modify it?

    Hi,
    Now, there is a jar file which contains a file that I want to modify. How can I get the file. After I get the file, I will modify it and replace the file in jar file. How can I complete it? Thank you.

    there is no direct method of updateing files in ajar file
    u have to do it this way
    u have to first unjar the file in a particular folder
    using java code java.util.jar package
    than through FileReader and FileWriter class u update ur
    the file whichever u want to update
    and then gain through java.util.jar package
    u create ur jar file again

  • How can i load Metadata file into georaster?

    Hello everybody,
    I stone a tiff file in my db,I stone tiff file like this:
    1.create GeoRaster Table:
    create table rm_image_t(
    georid number,
    file_type varchar2(30),
    image_file mdsys.sdo_georaster);
    2.create trigger:
    exec sdo_geor_utl.createdmltrigger('rm_image_t','image_file');
    3.Create raster data table:
    create table rdt1 of mdsys.sdo_raster(
    primary key(rasterid,pyramidlevel,bandblocknumber,rowblocknumber,columnblocknumber))
    lob(rasterblock) store as (nocache nologging);
    4.Grant:
    exec dbms_java.grant_permission('OPER','SYS:java.io.FilePermission','c:\aaa.tif','read');
    call dbms_java.grant_permission('MDSYS','SYS:java.io.FilePermission','c:\aaa.tif','read' );
    call dbms_java.grant_permission('OPER','SYS:java.io.FilePermission', 'c:\aaa.tif','read' );
    call dbms_java.grant_permission('PUBLIC','SYS:java.io.FilePermission','c:\aaa.tif','read' );
    call dbms_java.grant_permission('MDSYS','SYS:java.io.FilePermission','c:\aaa.tif','read' );
    call dbms_java.grant_permission('OPER','SYS:java.io.FilePermission', 'c:\aaa.tif','read');
    call dbms_java.grant_permission('PUBLIC','SYS:java.io.FilePermission','c:\aaa.tif','read');
    5.Insert tiff file:
    DECLARE
    geor SDO_GEORASTER;
    BEGIN
    -- Initialize an empty GeoRaster object into which the external image
    -- is to be imported.
    INSERT INTO rm_image_t
    values( 1, 'TIFF', sdo_geor.init('rdt1') );
    -- Import the TIFF image.
    SELECT image_file INTO geor FROM rm_image_t
    WHERE georid = 1 FOR UPDATE;
    sdo_geor.importFrom(geor,'blocksize=(512,512) compression=DEFLATE', 'TIFF', 'file','c:\aaa.tif');
    UPDATE rm_image_t SET image_file = geor WHERE georid = 1;
    COMMIT;
    END;
    Then:
    SQL> SELECT t.georid,
    2 sdo_geor.validategeoraster(t.image_file) isvalid
    3 from rm_image_t t order by georid;
    GEORID ISVALID
    1 TRUE
    But I do not know how to load tiff_file's metadata into georaster.
    Can you help me?thanks!

    My metadata file called aaa.met,it has the following info:
    GROUP = METADATA_FILE
         PRODUCT_CREATION_TIME = 2004-02-12T15:09:20Z
         PRODUCT_FILE_SIZE = 703.1
         STATION_ID = "EDC"
         GROUND_STATION = "SGS"
         GROUP = ORTHO_PRODUCT_METADATA
              SPACECRAFT_ID = "Landsat7"
              SENSOR_ID = "ETM+"
              ACQUISITION_DATE = 2001-10-03
              WRS_PATH = 138
              WRS_ROW = 036
              SCENE_CENTER_LAT = +34.6152272
              SCENE_CENTER_LON = +91.7569675
              SCENE_UL_CORNER_LAT = +35.5648302
              SCENE_UL_CORNER_LON = +90.9958720
              SCENE_UR_CORNER_LAT = +35.2772270
              SCENE_UR_CORNER_LON = +92.9740331
              SCENE_LL_CORNER_LAT = +33.9414953
              SCENE_LL_CORNER_LON = +90.5596099
              SCENE_LR_CORNER_LAT = +33.6605964
              SCENE_LR_CORNER_LON = +92.5005228
              SCENE_UL_CORNER_MAPX = 318373.500
              SCENE_UL_CORNER_MAPY = 3937531.500
              SCENE_UR_CORNER_MAPX = 497638.500
              SCENE_UR_CORNER_MAPY = 3903787.500
              SCENE_LL_CORNER_MAPX = 274455.000
              SCENE_LL_CORNER_MAPY = 3758352.000
              SCENE_LR_CORNER_MAPX = 453691.500
              SCENE_LR_CORNER_MAPY = 3724636.500
              BAND1_FILE_NAME = "aaa.tif"
              GROUP = PROJECTION_PARAMETERS
                   REFERENCE_DATUM = "WGS84"
                   REFERENCE_ELLIPSOID = "WGS84"
                   GRID_CELL_ORIGIN = "Center"
                   UL_GRID_LINE_NUMBER = 1
                   UL_GRID_SAMPLE_NUMBER = 1
                   GRID_INCREMENT_UNIT = "Meters"
                   GRID_CELL_SIZE_PAN = 14.250
                   GRID_CELL_SIZE_THM = 57.000
                   GRID_CELL_SIZE_REF = 28.500
                   FALSE_NORTHING = 0
                   ORIENTATION = "NUP"
                   RESAMPLING_OPTION = "NN"
                   MAP_PROJECTION = "UTM"
              END_GROUP = PROJECTION_PARAMETERS
              GROUP = UTM_PARAMETERS
                   ZONE_NUMBER = +46
              END_GROUP = UTM_PARAMETERS
              SUN_AZIMUTH = 147.9348938
              SUN_ELEVATION = 46.4220192
              QA_PERCENT_MISSING_DATA = 0
              CLOUD_COVER = 0
              PRODUCT_SAMPLES_PAN = 17814
              PRODUCT_LINES_PAN = 15754
              PRODUCT_SAMPLES_REF = 8907
              PRODUCT_LINES_REF = 7877
              PRODUCT_SAMPLES_THM = 4454
              PRODUCT_LINES_THM = 3939
              OUTPUT_FORMAT = "GEOTIFF"
         END_GROUP = ORTHO_PRODUCT_METADATA
         GROUP = L1G_PRODUCT_METADATA
              BAND_COMBINATION = "123456678"
              CPF_FILE_NAME = "L7CPF20011001_20011231_04"
              GROUP = MIN_MAX_RADIANCE
                   LMAX_BAND1 = 191.600
                   LMIN_BAND1 = -6.200
                   LMAX_BAND2 = 196.500
                   LMIN_BAND2 = -6.400
                   LMAX_BAND3 = 152.900
                   LMIN_BAND3 = -5.000
                   LMAX_BAND4 = 241.100
                   LMIN_BAND4 = -5.100
                   LMAX_BAND5 = 31.060
                   LMIN_BAND5 = -1.000
                   LMAX_BAND61 = 17.040
                   LMIN_BAND61 = 0.000
                   LMAX_BAND62 = 12.650
                   LMIN_BAND62 = 3.200
                   LMAX_BAND7 = 10.800
                   LMIN_BAND7 = -0.350
                   LMAX_BAND8 = 243.100
                   LMIN_BAND8 = -4.700
              END_GROUP = MIN_MAX_RADIANCE
              GROUP = MIN_MAX_PIXEL_VALUE
                   QCALMAX_BAND1 = 255.0
                   QCALMIN_BAND1 = 1.0
                   QCALMAX_BAND2 = 255.0
                   QCALMIN_BAND2 = 1.0
                   QCALMAX_BAND3 = 255.0
                   QCALMIN_BAND3 = 1.0
                   QCALMAX_BAND4 = 255.0
                   QCALMIN_BAND4 = 1.0
                   QCALMAX_BAND5 = 255.0
                   QCALMIN_BAND5 = 1.0
                   QCALMAX_BAND61 = 255.0
                   QCALMIN_BAND61 = 1.0
                   QCALMAX_BAND62 = 255.0
                   QCALMIN_BAND62 = 1.0
                   QCALMAX_BAND7 = 255.0
                   QCALMIN_BAND7 = 1.0
                   QCALMAX_BAND8 = 255.0
                   QCALMIN_BAND8 = 1.0
              END_GROUP = MIN_MAX_PIXEL_VALUE
              GROUP = PRODUCT_PARAMETERS
                   CORRECTION_METHOD_GAIN_BAND1 = "CPF"
                   CORRECTION_METHOD_GAIN_BAND2 = "CPF"
                   CORRECTION_METHOD_GAIN_BAND3 = "CPF"
                   CORRECTION_METHOD_GAIN_BAND4 = "CPF"
                   CORRECTION_METHOD_GAIN_BAND5 = "CPF"
                   CORRECTION_METHOD_GAIN_BAND61 = "CPF"
                   CORRECTION_METHOD_GAIN_BAND62 = "CPF"
                   CORRECTION_METHOD_GAIN_BAND7 = "CPF"
                   CORRECTION_METHOD_GAIN_BAND8 = "CPF"
                   CORRECTION_METHOD_BIAS = "IC"
                   BAND1_GAIN = "H"
                   BAND2_GAIN = "H"
                   BAND3_GAIN = "H"
                   BAND4_GAIN = "L"
                   BAND5_GAIN = "H"
                   BAND6_GAIN1 = "L"
                   BAND6_GAIN2 = "H"
                   BAND7_GAIN = "H"
                   BAND8_GAIN = "L"
                   BAND1_GAIN_CHANGE = "0"
                   BAND2_GAIN_CHANGE = "0"
                   BAND3_GAIN_CHANGE = "0"
                   BAND4_GAIN_CHANGE = "0"
                   BAND5_GAIN_CHANGE = "0"
                   BAND6_GAIN_CHANGE1 = "0"
                   BAND6_GAIN_CHANGE2 = "0"
                   BAND7_GAIN_CHANGE = "0"
                   BAND8_GAIN_CHANGE = "0"
                   BAND1_SL_GAIN_CHANGE = "0"
                   BAND2_SL_GAIN_CHANGE = "0"
                   BAND3_SL_GAIN_CHANGE = "0"
                   BAND4_SL_GAIN_CHANGE = "0"
                   BAND5_SL_GAIN_CHANGE = "0"
                   BAND6_SL_GAIN_CHANGE1 = "0"
                   BAND6_SL_GAIN_CHANGE2 = "0"
                   BAND7_SL_GAIN_CHANGE = "0"
                   BAND8_SL_GAIN_CHANGE = "0"
              END_GROUP = PRODUCT_PARAMETERS
              GROUP = CORRECTIONS_APPLIED
                   STRIPING_BAND1 = "NONE"
                   STRIPING_BAND2 = "NONE"
                   STRIPING_BAND3 = "NONE"
                   STRIPING_BAND4 = "NONE"
                   STRIPING_BAND5 = "NONE"
                   STRIPING_BAND61 = "NONE"
                   STRIPING_BAND62 = "NONE"
                   STRIPING_BAND7 = "NONE"
                   STRIPING_BAND8 = "NONE"
                   BANDING = "N"
                   COHERENT_NOISE = "N"
                   MEMORY_EFFECT = "N"
                   SCAN_CORRELATED_SHIFT = "N"
                   INOPERABLE_DETECTORS = "N"
                   DROPPED_LINES = N
              END_GROUP = CORRECTIONS_APPLIED
         END_GROUP = L1G_PRODUCT_METADATA
    END_GROUP = METADATA_FILE
    END
    I want load it into db and query the tif_file use coordinates.
    Can you pls tell me how to do it?

  • How can I add jar files into the namespace in code?

    My friends:
    I need to add jar files into my namespace dynamicly in my code.But the jar files might be repeated, I am not sure.so, i wonder how can I add them into my namespace, ignoring the repeated files?
    This is my code:
    URL[] urlArrayA = new URL[5];
    urlArray[0] = sample1;
    urlArray[1] = sample2;
    URL[] urlArrayB = new URL[5];
    urlArrayB[0] = sample3;
    urlArrayB[1] = sample4;
    URLClassLoader urlClassLoaderA = URLClassLoader.newInstance(urlArrayA);
    URLClassLoader urlClassLoaderB = URLClassLoader.newInstance(urlArrayB);
    how can i visit classes in urlClassLoaderA from classes in urlClassLoaderB?

    could anyone please answer the question for me ? thank you...

  • How can I import svg files into photoshop?

    I am trying to import some svg files into photoshop shapes, how is that done?

    Although you CAN open SVG into Illustrator, save it as PSD or Illustrator, I think Photoshop should directly support opening SVG files in the same way it does PDF. You set the pixel size you want and then rasterize it.

  • How can i convert ppt file into a keynote using windows 7 ?

    can i change a powerpoint file into a keynote file on my labtop using my windows 7 ?? if yes can i send it to someone who has mac OS and will it work well with him?

    No, he'll download it as a PPT.  Keynote can then open the PPT file, and he can choose to convert to the Keynote format once its open.
    Keynote: Supported file formats - Apple Support
    All he'll need to do is save it.

Maybe you are looking for