Reading/Writing JPEG file headers

Hi,
I am trying to take a JPEG file and read the markers in the file header. I might also want to add/alter markers in the header to alter images. This is the start of a big project managing JPEG files but unfortunately I don't know where to start with the Java in manipulating the JPEG files. Can anyone point me to any examples or tutorials etc.
Thanks a million,
HJ Monkey

If you are just interested in modifying tags in the headers then try the ImageIO (jdk1.4) package.
If this does not provide the functionality you need then try JAI or one of the many freely available
image handling or jpeg packages. If necessary you could probably write a simple JNI wrapper to
a native library if it provides the functionality you need.
matfud

Similar Messages

  • Reading/Writing .xlsx files using Webdynpro for Java

    Dear All
    I have a requirement to read/write excel files in .xlsx format. I am good in doing it with .xls format using jxl.jar. The jxl.jar doesn't support .xlsx format. Kindly help me in understanding how do I need to proceed on reading/writing .xlsx files using Webdynpro for Java.
    Thanks and Regards
    Ramamoorthy D

    i am using jdk 1.6.22 and IBM WebSphere
    when i use poi-3.6-20091214.jar and poi-ooxml-3.6-20091214.jar  to read .xlsx file. but i am getting following errors
    The project was not built since its classpath is incomplete. Cannot find the class
    file for java.lang.Iterable. Fix the classpath then try rebuilding this project.
    This compilation unit indirectly references the missing type java.lang.Iterable
    (typically some required class file is referencing a type outside the classpath)
    how can i resolve it
    here is the code that i have used
    public class HomeAction extends DispatchAction {
         public ActionForward addpage(
                             ActionMapping mapping,
                             ActionForm form,
                             HttpServletRequest request,
                             HttpServletResponse response)
                             throws Exception {     
                             String name = "C:/Documents and Settings/bharath/Desktop/Book1.xlsx";
               FileInputStream fis = null;
               try {
                   Object workbook = null;
                    fis = new FileInputStream(name);
                    XSSFWorkbook wb = new XSSFWorkbook(fis);
                    XSSFSheet sheet = (XSSFSheet) wb.getSheetAt(0);
                    Iterator rows = sheet.rowIterator();
                    int number=sheet.getLastRowNum();
                    System.out.println(" number of rows"+ number);
                    while (rows.hasNext())
                        XSSFRow row = ((XSSFRow) rows.next());
                        Iterator cells = row.cellIterator();
                        while(cells.hasNext())
                    XSSFCell cell = (XSSFCell) cells.next();
                    String Value=cell.getStringCellValue();
                    System.out.println(Value);
               } catch (IOException e) {
                    e.printStackTrace();
               } finally {
                    if (fis != null) {
                         fis.close();
                return mapping.findForward("returnjsp");

  • How ftp reader read a JPEG file.

    i have to read a jpeg file through FTP reader. i want to know that should i need to define schema for native format???
    if yes then which type of file is this...
    or i dnt need to define.please let me know.
    and plz tell me should i need to change in oc4j-ra.xml???
    please help
    can anyone give me some suggestion on this
    thanks

    i have to read file in binary format.can u tell me which type of file can u be used in binary format other than jpg.
    its not working fine. m geting this error
    [deployProcess] Deploying process E:\jdevstudio10132\jdev\mywork\ftpappl\txtread\output\bpel_txtread_1.0.jar
    BUILD FAILED
    E:\jdevstudio10132\jdev\mywork\ftpappl\txtread\build.xml:79: A problem occured while connecting to server "chdsez116553d" using port "8888": bpel_txtread_1.0.jar failed to deploy. Exception message is: ORABPEL-05215
    Error while loading process.
    The process domain encountered the following errors while loading the process "txtread" (revision "1.0"): BPEL validation failed.
    BPEL source validation failed, the errors are:
    [Error ORABPEL-10902]: compilation failed
    [Description]: in "bpel.xml", XML parsing failed because "undefined part element.
    In WSDL at "file:/D:/product/10.1.3.1/OracleAS_8/bpel/domains/default/tmp/.bpel_txtread_1.0_2aa20df9f4e8b3b3eb916175ca90cbb3.tmp/txtread.wsdl", message part element "{http://schemas.xmlsoap.org/ws/2003/03/addressing}ReplyTo" is not defined in any of the schemas.
    Please make sure the spelling of the element QName is correct and the WSDL import is complete.
    [Potential fix]: n/a.
    If you have installed a patch to the server, please check that the bpelcClasspath domain property includes the patch classes.
    at com.collaxa.cube.engine.deployment.CubeProcessHolder.bind(CubeProcessHolder.java:285)
    at com.collaxa.cube.engine.deployment.DeploymentManager.deployProcess(DeploymentManager.java:862)
    at com.collaxa.cube.engine.deployment.DeploymentManager.deploySuitcase(DeploymentManager.java:728)
    at com.collaxa.cube.ejb.impl.BPELDomainManagerBean.deploySuitcase(BPELDomainManagerBean.java:445)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
    at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
    at com.evermind.server.ejb.interceptor.system.JAASInterceptor$1.run(JAASInterceptor.java:31)
    at com.evermind.server.ThreadState.runAs(ThreadState.java:646)
    at com.evermind.server.ejb.interceptor.system.JAASInterceptor.invoke(JAASInterceptor.java:34)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
    at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:50)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
    at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
    at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
    at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:87)
    at DomainManagerBean_RemoteProxy_4bin6i8.deploySuitcase(Unknown Source)
    at com.oracle.bpel.client.BPELDomainHandle.deploySuitcase(BPELDomainHandle.java:319)
    at com.oracle.bpel.client.BPELDomainHandle.deployProcess(BPELDomainHandle.java:341)
    at deployHttpClientProcess.jspService(_deployHttpClientProcess.java:376)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    at oracle.security.jazn.oc4j.JAZNFilter$1.run(JAZNFilter.java:396)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:410)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:623)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
    at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
    at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
    at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
    at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
    at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
    at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    at java.lang.Thread.run(Thread.java:595)
    Total time: 0 seconds
    please help

  • Suddenly my Nikon Coolpix will not upload onto my 09 iphoto it takes for ever then it just shows blank squares no pics and a message that states it cannot read the JPEG files. Can anyone help me, please.

    Suddenly my Nikon Coolpix will not upload on to my 09 iphoto it takes for ever then it just shows blank squares no pics and a message that states it cannot read the JPEG files. Can anyone help me, please. I have never had this problem before.

    As a Test:
    Hold down the option (or alt) key and launch iPhoto. From the resulting menu select 'Create Library'
    Import a few pics into this new, blank library. Is the Problem repeated there?
    You could also try reformat the Card with your camera
    Regards
    TD

  • PDA example: Reading a jpeg file into a picture control

    Hi
    Does anybody have a simple PDA example of how to read a .jpg file and show it in a picture control. The jpg examples I've found does not compile for PDA.

    Evan wrote in message news:<[email protected]>...
    > In LabVIEW for windows there are VIs to read in JPEGs, however the PDA
    > module does not support those VIs, so I do not believe there is a way
    > to display JPEGs.
    The hard way would be to write your own JPEG -> Bitmap / Array
    de-compression routine. You will probably find example (C++) code at
    the JPEG web site.
    http://www.jpeg.org/jpeg_about.html

  • Performance of ImageIO.read with jpeg files

    Hi all... I'm pulling my hair out trying to get a seemingly trivial task to work fast in Java. I'm trying to read in a set of jpeg files, and all I really want out of the files (for now) is width and height. The code I'm testing is:
    for(int i = 0; i < fileList.length; i++)
    ImageInputStream iis = ImageIO.createImageInputStream(fileList);
    BufferedImage bi = ImageIO.read(iis);
    The size of the files I'm trying to read varies from between 80k and 150k. Now get this... here's a real shocker for all you jdk1.4.0 fans out there... the ImageIO.read() method takes as long as 4 seconds to read each file! I've got the standard, plain vanilla jdk1.4.0 running on Redhat 7.1, so I'm wondering if this is an issue with the native code method com.sun.imageio.plugins.jpeg.JPEGImageReader.readImage(). The reason I think this is the case is two-fold: 1) I ran -Xrunhprof on this app, and a full 20% of the cpu time is spent in that method. Another 15% is spent in sun.awt.color.CMM.cmmColorConvert(). 2) The same code ran against a directory filled with GIF files runs blazingly fast... the first image decoded takes a second or so, but the next few take milliseconds to decode.
    Is there some optimized native code jpeg readers that I perhaps didn't download? The documentation on this site, to put it bluntly, SUCKS. It's impossible to find any information without resorting to multiple searches, so I highly doubt that I've actually installed everything I should have just by downloading the one installation file for linux. (not the RPM, the one that lets you put it where you want to).
    Any hints or outright solutions to getting jpeg files to be read any faster than this? This shouldn't be rocket science... Every application I've ever seen on any platform up until now can run circles around my pitiful 2 lines of code.
    Thanks for your help!

    you see....I use the ImageReader.readAll(pageIndex, defReadParam) to read from page 'm' to 'n'. The overall performance (speed) is ok. But, the thing is, the thing pauses for some 15 secs approx to read the first page. Then on, it is QUITE fast. Now, if I need to read 500 pages, then the efficiency will be good. But for a single page? The 15 secs is be too long. Anyway I am trying to read a tiff file (which is not too resolute). Guess the first call does smells the ecnoding format to prepare for decoding, etc...But what I want to know is, is there a way to bring down this time. If not, is there any other way to read a tiff page more efficiently? Actually I need to read some pages & write them to a stream...thats all.

  • Reading/writing PDF files using JAVA

    how to read/write a PDF file using java,
    while i read a pdf file using BUfferedReader class it gives a list of char. which is not readable.
    how to convert those files to readable format.?
    is there any special class for doin that.?
    plz explain..?

    is there any special class for doin that.?Yes, I'm sure Google knows a few libraries that ca do that.

  • BPEL reading/writing a file

    Hi,
    To test my BPEL process, I am using FileAdapter to read from a file/write to a file. It works fine with my localhost as the SOA server. When I deploy to the development server, is there anyway I can put the file inside the project and deploy it as part of the jar file?
    Thanks
    John

    Yes it sounds strange that you want move the file you are reading. This can be done via the ant script although I haven't used the FTP task. Create a pre-build.xml file. this will be called by the build.xml. Have a look at this link http://ant.apache.org/manual/index.html
    Otherwise if you just want to change the directory location based on the environment, use the logical path this means you can update the location in the BPEL console.
    You can also use a parameter in the properties file. you need a pre-build.xml and post-build.xml
    pre-build.xml
    <?xml version="1.0"?>
    <project name="bpel.pre-build" default="pre-build" basedir="./bpel">
    <property name="xxsoa_log_dir_deploy" value="${xxsoaLogDir}"/>
    <target name="pre-build">
    <bpelc input="${basedir}/bpel.xml" rev="${rev}" deploy="${domain}" force="true">
    <customize>
    <partnerLinkBinding name="WriteHTMLService">
    <property name="wsdlLocation">WriteHTMLService.wsdl</property>
    <property name="XXSOA_LOG_DIRECTORY">${xxsoa_log_dir_deploy}</property>
    <property name="retryInterval">60</property>
    </partnerLinkBinding>
    </customize>
    </bpelc>
    <copy file="bpel.xml" tofile="bpel_orig.xml" overwrite="true"/>
    <copy file="_bpel.xml" tofile="bpel.xml" overwrite="true"/>
    </target>
    </project>
    post-build.xml
    <?xml version="1.0"?>
    <project name="bpel.post-build" default="post-build" basedir="./bpel">
    <target name="post-build">
    <echo>
    | Copying bpel_orig.xml to bpel.xml
    </echo>
    <copy file="bpel_orig.xml" tofile="bpel.xml" overwrite="true"/>
    </target>
    </project>

  • Reading & writing to file using ArrayList String incorrectly

    Hi Java Experts,
    I am running out of ideas on why my findSnomedCodes.java program is filling up the output file (Snomed-Codes.txt) with the
    same information ([M44110|T33010, , M92603|T10350, ]) continuously. This program goes through a dummy patient result file
    and pickup the 3rd line of each record and insert it into an ArrayList of String before writing it into a Snomed-Codes.txt
    file. A followed up method prints out everything from Snomed-Codes.txt.
    Below is the source code of findSnomedCodes.java program:
    import java.io.*;
    import java.io.IOException;
    import java.lang.String;
    import java.lang.Character;
    import java.util.regex.*;
    import java.util.ArrayList;
    import java.util.List;
    public class FindSnomedCode {
    static List<String> complete_records = new ArrayList<String>();
    static public void getContents(File existingFile) {
    StringBuffer contents = new StringBuffer();
    BufferedReader input = null;
    int line_number = 0;
    int number_of_records = 0;
    String snomedCodes = null;
    try {
    input = new BufferedReader( new FileReader(existingFile) );
    String current_line = null;
    while (( current_line = input.readLine()) != null) {
    // Create a pattern to match for the "\"
    Pattern p = Pattern.compile("\\\\");
    // Create a matcher with an input string
    Matcher m = p.matcher(current_line);
    boolean beginning_of_record = m.find();
    if (beginning_of_record) {
    line_number = 0;
    number_of_records++;
    } else {
    line_number++;
    if (line_number == 2) {
    snomedCodes = current_line;
    System.out.println(snomedCodes);
    complete_records.add(current_line);
    catch (FileNotFoundException ex) {
    ex.printStackTrace();
    catch (IOException ex){
    ex.printStackTrace();
    finally {
    try {
    if (input!= null) {
    input.close();
    catch (IOException ex) {
    ex.printStackTrace();
    static public void setContents(File reformatFile, List snomedCodes)
    throws FileNotFoundException, IOException {
    Writer output = null;
    try {
    output = new BufferedWriter( new FileWriter(reformatFile) );
    while (snomedCodes.iterator().hasNext())
    output.write( snomedCodes.toString() );
    finally {
    if (output != null) output.close();
    static public void printContents(File existingFile) {
    //...checks on existingFile are elided
    StringBuffer contents = new StringBuffer();
    BufferedReader input = null;
    int line_number = 0;
    int number_of_records = 0;
    long total_number_of_lines = 0;
    String snomedCodes = null;
    try {
    input = new BufferedReader( new FileReader(existingFile) );
    String current_line = null;
    while (( current_line = input.readLine()) != null)
    System.out.println(current_line);
    catch (FileNotFoundException ex) {
    ex.printStackTrace();
    catch (IOException ex){
    ex.printStackTrace();
    finally {
    try {
    if (input!= null) {
    input.close();
    catch (IOException ex) {
    ex.printStackTrace();
    public static void main (String args[]) throws IOException {
    File currentFile = new File("D:\\AP Data Conversion\\1988\\dummy_test_records.txt");
    getContents(currentFile);
    File snomedFile = new File( "D:\\AP Data Conversion\\1988\\Snomed-Codes.txt");
    setContents(snomedFile, complete_records);
    printContents(snomedFile);
    The output from Netbeans/Java is as follows:
    M44110|T33010
    M92603|T10350
    Exception in thread "main" java.io.IOException: There is not enough space on the disk
    at java.io.FileOutputStream.writeBytes(Native Method)
    at java.io.FileOutputStream.write(FileOutputStream.java:260)
    at sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336)
    at sun.nio.cs.StreamEncoder$CharsetSE.implClose(StreamEncoder.java:427)
    at sun.nio.cs.StreamEncoder.close(StreamEncoder.java:160)
    at java.io.OutputStreamWriter.close(OutputStreamWriter.java:222)
    at java.io.BufferedWriter.close(BufferedWriter.java:250)
    at FindSnomedCode.setContents(FindSnomedCode.java:90)
    at
    FindSnomedCode.main(FindSnomedCode.java:134)---------------------------------------------------------------------------------
    The content of Snomed-Codes.txt file is filled with continuous lines of [M44110|T33010, , M92603|T10350, ] as follows:
    [M44110|T33010, , M92603|T10350, ][M44110|T33010, , M92603|T10350, ][M44110|T33010, , M92603|T10350, ][M44110|T33010, ,
    M92603|T10350, ][M44110|T33010, , M92603|T10350, ][M44110|T33010, , M92603|T10350, ][M44110|T33010, , M92603|T10350,
    ][M44110|T33010, , M92603|T10350, ][M44110|T33010, , M92603|T10350, ][M44110|T33010, , M92603|T10350, ][M44110|T33010, ,
    M92603|T10350, ][M44110|T33010, , M92603|T10350, ][M44110|T33010, , M92603|T10350, ][M44110|T33010, , M92603|T10350,
    I must have done something wrong with the ArrayList.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    while (snomedCodes.iterator().hasNext())
      output.write( snomedCodes.toString() );
    }Here you have some kind of a list or something (I couldn't stand to read all that unformatted code but I suppose you can find out). It has an iterator which gives you the entries of the list one at a time. You keep asking if it has more entries -- which it does -- but you never get those entries by calling the next() method, so it always has all the entries still available.
    And your code inside the loop is independent of the iterator, so it's rather pointless to iterate over the entries and output exactly the same data for each entry. Even if you were iterating correctly.

  • How to read in JPEG file properties

    Hello AS Community!
    I am wondering if there is some way to do the following:
    (1) I have a folder filled with JPEGS with which I can have
    my SWF access via XML.
    (2) I would like to create two arrays, one filled with the
    widths (in pixels) and the other with heights (in pixels) of all of
    these JPEGs in the aforementioned folder.
    I am not interested in loading/viewing any of the JPEGs from
    this folder into my SWF, I really just want the SWF to use each
    image's width/height information for something else.
    Do you know how when you right-click in Windows and choose
    "Properties" of a JPEG image, you can see the width/height values
    of said JPEG in pixels? It is these properties that I would like to
    load into arrays. I know how to create and load up arrays, so that
    is not the topic of this post, but rather how do I read in these
    Windows "intrinsic" width/height properties?
    Any help would be greatly appreciated,
    -john

    ropeGun wrote:
    > Hello AS Community!
    >
    > I am wondering if there is some way to do the following:
    >
    > (1) I have a folder filled with JPEGS with which I can
    have my SWF access via
    > XML.
    > (2) I would like to create two arrays, one filled with
    the widths (in pixels)
    > and the other with heights (in pixels) of all of these
    JPEGs in the
    > aforementioned folder.
    >
    > I am not interested in loading/viewing any of the JPEGs
    from this folder into
    > my SWF, I really just want the SWF to use each image's
    width/height information
    > for something else.
    >
    > Do you know how when you right-click in Windows and
    choose "Properties" of a
    > JPEG image, you can see the width/height values of said
    JPEG in pixels? It is
    > these properties that I would like to load into arrays.
    I know how to create
    > and load up arrays, so that is not the topic of this
    post, but rather how do I
    > read in these Windows "intrinsic" width/height
    properties?
    >
    > Any help would be greatly appreciated,
    >
    > -john
    >
    Hi ropeGun,
    You're only really going to achieve this with a server side
    script
    written in PHP, ASP etc. You can then get the script to loop
    through the
    folder and examine each file and store it's width and height.
    How you
    then pass this information back to Flash is down to your
    personal
    preference. You could go the 'name/value' pairs route, but
    with a large
    directory you run the risk of loading in a rather large
    amount of data
    in a less than ideal format.
    A more concise route would be to use some form of remoting
    like AMFPHP
    (www.amfphp.org) and just get the PHP to make the Arrays too
    and pass
    the complex data back all at once. This will save processing
    and
    mangling once it hits Flash.Leaving you with just hooking up
    the arrays.
    Obviously if you were loading them in then you could just
    grab these
    values once loaded, but this isn't your goal as you have
    already indicated.
    Might I suggest you use a multi-dimensional array to store
    these width
    and height values in. It will make accessing the values far
    easier and
    will make sure you only have to contend with one index per
    JPG
    dimensions. I suspect you were already planning on doing that
    anyhoo :D
    HTH
    regs
    m
    Mike Jones
    FlashGen.Com
    w./ www.flashgen.com
    e./ forum_postsATflashgenDOTcom
    b./ blog.flashgen.com

  • Reading & writing to file using ArrayList String incorrectly (2)

    I have been able to store two strings (M44110|T33010, M92603|T10350) using ArrayList<String>, which represent the result of some patient tests. Nevertheless, the order of these results have been stored correctly.
    E.g. currently stored in file Snomed-Codes as -
    [M44110|T33010, M92603|T10350][M44110|T33010, M92603|T10350]
    Should be stored and printed out as -
    M44110|T33010
    M92603|T10350
    Below is the detail of the source code of this program:
    import java.io.*;
    import java.io.IOException;
    import java.lang.String;
    import java.util.regex.*;
    import java.util.ArrayList;
    public class FindSnomedCode {
        static ArrayList<String> allRecords = new ArrayList<String>();
        static public ArrayList<String> getContents(File existingFile) {
            StringBuffer contents = new StringBuffer();
            BufferedReader input = null;
            int line_number = 0;
            int number_of_records = 0;
            String snomedCodes = null;
            ArrayList<String> complete_records = new ArrayList<String>();
            try {
                input = new BufferedReader( new FileReader(existingFile) );
                String current_line = null;
                while (( current_line = input.readLine()) != null) {
                    // Create a pattern to match for the "\"
                    Pattern p = Pattern.compile("\\\\");
                    // Create a matcher with an input string
                    Matcher m = p.matcher(current_line);
                    boolean beginning_of_record = m.find();
                    if (beginning_of_record) {
                        line_number = 0;
                        number_of_records++;
                    } else {
                        line_number++;
                    if ( (line_number == 2) && (current_line.length() != 0) ) {
                        snomedCodes = current_line;
                        System.out.println(snomedCodes);
                        complete_records.add(current_line);
            catch (FileNotFoundException ex) {
                ex.printStackTrace();
            catch (IOException ex){
                ex.printStackTrace();
            finally {
                try {
                    if (input!= null) {
                        input.close();
                catch (IOException ex) {
                    ex.printStackTrace();
            return complete_records;
        static public void setContents(File reformatFile, ArrayList<String> snomedCodes)
                                     throws FileNotFoundException, IOException {
           Writer output = null;
            try {
                output = new BufferedWriter( new FileWriter(reformatFile) );
                  for (String index : snomedCodes) {
                      output.write( snomedCodes.toString() );
            finally {
                if (output != null) output.close();
        static public void printContents(File existingFile) {
            StringBuffer contents = new StringBuffer();
            BufferedReader input = null;
            int line_number = 0;
            int number_of_records = 0;
            String snomedCodes = null;
            try {
                input = new BufferedReader( new FileReader(existingFile) );
                String current_line = null;
                while (( current_line = input.readLine()) != null)
                    System.out.println(current_line);
            catch (FileNotFoundException ex) {
                ex.printStackTrace();
            catch (IOException ex){
                ex.printStackTrace();
            finally {
                try {
                    if (input!= null) {
                        input.close();
                catch (IOException ex) {
                    ex.printStackTrace();
        public static void main (String args[]) throws IOException {
            File currentFile = new File("D:\\dummy_patient.txt");
            allRecords = getContents(currentFile);
            File snomedFile = new File( "D:\\Snomed-Codes.txt");
            setContents(snomedFile, allRecords);
            printContents(snomedFile);
    }There are 4 patient records in the dummy_patient.txt file but only the 1st (M44110|T33010) & 3rd (M92603|T10350) records have results in them. The 2nd & 4th records have blank results.
    Lastly, could someone explain to me the difference between java.util.List & java.util.ArrayList?
    I am running Netbeans 5.0, jdk1.5.0_09 on Windows XP, SP2.
    Many thanks,
    Netbeans Fan.

    while (snomedCodes.iterator().hasNext())
      output.write( snomedCodes.toString() );
    }Here you have some kind of a list or something (I couldn't stand to read all that unformatted code but I suppose you can find out). It has an iterator which gives you the entries of the list one at a time. You keep asking if it has more entries -- which it does -- but you never get those entries by calling the next() method, so it always has all the entries still available.
    And your code inside the loop is independent of the iterator, so it's rather pointless to iterate over the entries and output exactly the same data for each entry. Even if you were iterating correctly.

  • Reading/writing .ico files

    I'm working on a coldfusion system where users can upload
    their own favicon files for their site. To allow compatibility with
    IE I want to allow for .ico files but I need to determine their
    dimensions so that I can limit the size. The restrictions of the
    JVM mean that Coldfusion can't read or write .ico files and I was
    wondering if anyone had any suggestions.
    I'm currently trying to write a function which uses the Java
    JIMI library (
    JIMI) but it's not
    simple and keeps preventing me from deleting images once I've read
    them (possibly because I'm using it wrongly).
    If anyone can help then that'd be great.

    A
    posting
    on image processing made me have another look at your problem.
    I think you should install the
    hotfixes.
    One of them actually solves the problem whereby
    "CFImage and the image functions can leave an image file locked
    after an initial write to disk in Adobe ColdFusion 8.0.1."

  • Reading/Writing multiple files

    Hey,
    I've got a folder on my computer with 100+ text files. So I'm
    trying to make a projector that, once I've chosen a directory, will
    go through all the files in that folder looking for a certain
    string. I know how to use the FileXtra4 to set the directory, and
    I've had programs read and write to files before, but I'm not sure
    how to do it on such a large scale.
    If anyone can help it would be greatly appreciated.

    You can use Director's command getNthFileNameInFolder() to
    mke a list of
    all the files in a given folder, then use pRegEx to search
    through the
    text of each one.
    A much easier way would be to use BuddyAPI. It has a command
    called
    baFileList() which will give you the names of all the files
    in a folder,
    then you can use pRegEx or another xtra to search through
    each one. The
    same folks who brought us BuddyAPI also make budFile which
    can do the
    text search in a much easier way than pRegEx (though it will
    likely be a
    bit slower). Though it is terribly confusing and hard to use
    if you are
    not familiar with regular expressions, it is by far the
    fastest method
    of searching text.

  • Reading/Writing Excel Files

    I'm looking for a relatively straightforward way to read data from a .xls file and write out to another one using only standard java facilities, so no open source library suggestions please.

    Excel can be accessed via JDBC, have a search for that, can't remember the details - just a JDBC name string. But really your best choice is the Jxl or JExcel (or whatever it's called) library. Apache POI is to be avoided, having the curious distinction of being both bloated and incomplete, as well as shocking performance.

  • Reading/writing XML files

    hi
    i want to makeXML based config files for my system,i didn`t example to write/read XML files(parsing).
    please provide some example ,Also,is there some alternative for readind data?
    Thanks

    See for example XML rlated taglibs in Coldtags suite:
    http://www.servletsuite.com/jsp.htm

Maybe you are looking for

  • DVI to video will not work- why not?

    I have a DVI to video adapter connected to my second dvi output. I am running it to a small monitor via composite cable. I can not get a clear image. The picture is black and white, distorted with crooked vertical black bars. It looks like it may be

  • "Contacts" icon on the dock

    I noticed that the iPod Touch has a "Contacts" icon on the dock. Can I get that on my iPhone, so I don't have to go to the phone first before accessing my contacts list?

  • Heading to italy need some help new to mac

    hey everybody i just bought an ibook g4 a few days ago and i love it. i am heading overseas to italy to stay with some family for the summer. and i wanted to know if i would be able to get wireless internet there or if there is wi-fi if my airport ex

  • QT Pro to wmv export question

    I made a small audio file from QT Pro 7.6. Exported it to wmv format. Works fine, except that the end is clipped off. Seems that I can get the whole thing if I stop recording after a lot of silence at the end. What is the best way to send an audio fi

  • Buying a new DVD recorder

    My internal 2X superdrive is on its last legs. Does anyone have experience installing a new DVD recorder? How did it go? Can I upgrade to an 8x recorder or do I need to stay at painfull 2x? How much did you spend? Can you recommend a drive? Pricewatc