Problem with Time handeling - again, please help

I've some difficulties with handeling Date and time. I'm reading the date and Time seperately from a file as string. Now I need to calculate the difference between two times (both are in string format). Same problem for the date. I need to calculate the difference between two dates which are also in string format. I don't know how to do that.
Can anybody help me?
Thanks in advance.

I am not sure of the specifics, but it could be accomplished by recording the long value returned by System.currentTimeMillis() for dates when they are constructed and creating a class to calculate the exact calendar date from these millisecond values. If the dates are not constructed from System.currentTimeMillis() you could make your own date base to create comparisons from and transform the strings accordingly. Good luck.

Similar Messages

  • Firefox is having problems with "Southwest Airlines website" Please help soon

    Whenever I go on Southwest Airline website, it does not work. I am having this problem since last month. Please help on this as soon as you can.

    Clear the cache and the cookies from sites that cause problems.
    * "Clear the Cache": Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    * "Remove the Cookies" from sites causing problems: Tools > Options > Privacy > Cookies: "Show Cookies"
    Other things that need your attention:
    Your above posted system details show outdated plugin(s) with known security and stability risks that you should update.
    * Shockwave Flash 10.0 r22
    * Java Plug-in 1.6.0_07 for Netscape Navigator (DLL Helper)
    Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.
    *http://kb.mozillazine.org/Flash
    *http://www.adobe.com/software/flash/about/
    Update the [[Java]] plugin to the latest version.
    *http://kb.mozillazine.org/Java
    *http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform: Download JRE)

  • Problem with adobe acrobat/reader - please help!

    Hello,
    My acrobat reader was fine and I was able to open the pdf files sent to me, then suddenly it just wouldn't open anything at all.  It went into open mode and just stayed there, and wouldn't let me close it.  Then I got a message saying "there is a problem with adobe acrobat/reader.  Please exit and try again".  I've done this lots of times and it still isn't working.
    I would be very grateful for any help or suggestions.  I have windows 7, and as I said its all been fine up until now.
    Thanks.
    mspryce.

    This is the Acrobat forum, not the Reader forum. You should check the reader forum. In the meantime, if you are not running AR9.3 or so, you should update. Prior versions before 9 are not designed for Win7 and that might be your issue -- you gave no indication of version.

  • Weird problems with kt7 turbo (6330), PLEASE HELP!!

    I just this last week purchased an older kt7 turbo (6330) to upgrade my brother's computer. I am pairing this with an Athlon XP 1700 processor. After installing all the hardware and booting up the computer, I started getting various errors. Sometimes the screen would just flash all kinds of colors, sometimes it would say something about a bios check not detecting the a: drive followed by insistent beeping, sometimes it just wouldn't start at all. After much hassle, I finally got the newest bios installed from MSI that claimed to fix some stuff between this motherboard and an Athlon XP 1700. (I didn't at the time suspect this to be the true culprit) Finally on Sunday afternoon, after a cold start, it magically started up and I finally got Windows XP installed. I found some drivers on the reference CD that seemed to help some. But now, after about 5-10 minutes, depending on the software being used, the computer will just shut itself down after a 60 second warning message. When I try reseting it, I start getting all of those weird errors again. The only way to get the computer to start up normally again is to let it sit for about 10-15 minutes to cool down, and then cold start it. At which point it will work again for another 10-15 minutes and shut down again. I am getting SOOOOO tired of these MSI motherboards not working for me!! I think MSI has a personal problem with me. PLEASE help me!! By the way, I don't think it's power related, cause I just put in a brand new P4 certified 400Watt powersupply.

    Sounds like your heatsink on your CPU may not be seated correctly. Try pulling it, cleaning, reapplying compound, and reseating it.

  • Problem with touch screen. Please help!!!

    Ok I bought an iPad about a month ago now. At first it worked perfectly, runs apps smoothly, etc. But then something happened to the touch screen, it just randomly like pressed itself, it went into apps on its own and zoom in and out while on safari just randomly. For about 3 weeks this issue disappeared, but now it happens again but more constantly and for more time please help. I think this video will explain my issue more clearly. http://www.youtube.com/watch?v=e1qyvHV43yg Please I just don't want this issue anymore. Any help will be appreciated.

    OK...so it seems that many iPad owners have the same issue with the screen "self registering touches". You'll see multiple posts on the forums from "self touching" to "self registering" to "freaking out".
    Well, I also have this annoying problem.
    Trust me when I say that cleaning the screen, resets, charging, deleting apps, static, and so on haven't anything to do with causing or resolving this issue.
    Here is a little tip to show you what is actually going on. Download a free app that shows you "screen touches". Harbor Master is one that I've heard of that led me to this...but I prefer to use that pocket pond app...only because I can just sit back and watch without having to move boats around.
    ...When you notice the problem, open up the app. I've noticed on mine that it only self registers touches along the side. Exact location is (when holding iPad in landscape position, home button on left) along the top of the screen...from top middle to the top right corner.
    I have called Apple...the tech was polite and tried to help. ...But the only suggestions were to reset (as i've already done) then if that didn't work I was to do a reload while sync'd. He stated that if none of that worked then to take it to the store...
    Since I am in Florida for the month and the nearest Apple store is 6hrs away...I will wait until I go back home HI and visit a store that is close by.

  • IOS 8.0.2 update causing problems with wifi connectivity..please help

    latest update having problems ...please help..!!!!!!!!!!

    Just a quick snapshot of my chain of events.  I’m currently on my fourth iPhone 6 Plus 64GB here in London, UK. Every time I have spoken to AppleCare and told them that I have gone through all the Wi-Fi troubleshooting methods possible they have asked me to get a brand new retail replacement as I’m within my 14 day return period.  I’ve been experiencing the following issues:
    Wi-Fi disconnects and switches to 4G (Restart required for temp fix)
    Wi-Fi is still active but there is no traffic or activity– often when in sleep mode for long periods of time.  (Toggle Wi-Fi on/off for temp fix)
    Wi-Fi disconnects and cannot find any networks (restart required for temp fix)
    This has been occurring on both iOS 8 and 8.0.2
    The issues are the same on both my 2.4Ghz and 5Ghz networks
    This is affecting my ip6+ and 5s (5s used to work perfect on ios7 on same networks) – My MBP-R and all other devices run perfectly on my network.
    I spoke to AppleCare again yesterday and asked for their advice as its now my fourth iPhone in just under a month. This time they said that apple were fully aware of the Wi-Fi problem and that new repair tickets were not being raised for their engineers as they are already working hard to get this resolved. They also said they could see all the issues raised on the apple discussions boards which they usually don’t admit too! I asked what to do next and the advisor apologised and said this is clearly a software glitch and will be resolved in the next update. I asked for a timescale but unfortunately none was given.
    As stated above I have tried all the troubleshooting methods discussed on forums and on tech websites but the only thing that gives me a stable connection without any disconnects (especially on my 6 plus) is turning cellular/mobile data off when I know I’m going to be on Wi-Fi for a sustained period of time (e.g. at home or work). I appreciate this is annoying but it’s the best temp fix until an update comes out.
    Hope it helps everyone who is having issues with their devices that have cellular functionality.
    Any comments welcome

  • Problem with Desktop Skype freezing, please help

    2 days ago, Dec. 23rd, I started up Skype as usual, but after about a minute, it froze, soon becoming "not responding". I opened Task Manager to try to end it manually, but Task Manager quickly became "not responding" as well, as did Chrome when I opened it when I tried to search for a solution. This had never happened before, and since has only happened when I am trying to use Skype for Desktop. I tried uninstalling and reinstalling multiple times, switching to an older version, and running an antivirus scan to see if a virus might be causing the problem, but none of this helped, and it still freezes itself along with all my other programs, forcing me to restart my computer if I want to be able to use it. I have been using Windows 8 Skype instead today, with no problems, but Skype for Desktop is more convenient for me, and I would very much appreciate it if someone would please help me.
    Also, I don't know if this might be related to the problem, but today I had Task Manager open before starting Skype for Desktop, hoping I could end it before it caused everything to freeze (I couldn't), I was able to see before it froze that Skype was using 100% of my Disk.
    Solved!
    Go to Solution.

    Please,  run the DirectX diagnostics tool.
    Go to Windows Start and in the Run box type dxdiag.exe and press the OK button. This will start the DirectX diagnostics program. Run this diagnostics and save the results to a file. Please, attach this file to your post.
    Be aware that you will have to zip this file before attaching it here.

  • PROBLEM with a PEARL 9105 please help me

    Hi ,I've got  a PEARL 9105 (with 14 characters) and I had a problem with it so I made an upgrade of it but when I upgraded it the phone is regognize by the Os as a 9100 with 20 characters. So I can't write correctly an sms or mail or anything . I tried to upgrade again but without success. Please HELP ME.

    Hey dumpeal2,
    Welcome to the forums.
    Try following the instructions here to backup and do a clean reload of your device software. http://bbry.lv/cKy9A0 if you get the same result then I would suggest contacting your service provider and have them escalate your issue to RIM. 
    -SR
    Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)!

  • Multiple Problems with itunes...PLEASE HELP

    i'm crossing posting this to try and get as much help as possible, so i'm sorry if you see this in a bunch of places.....
    i posted awhile back and didnt get much help and i'm still having problems with itunes
    first of all when i open itunes it attempts to do the gapless playback stuff....if i let it do it....it gets half way through and freezes....but if i stop it before it freezes, i am able to play music BUT not import any songs from cd, ipod, or downloading software....
    so, i deleted the library and imported "iTunes Music Library.xml"....then i went into my itunes folder and started dropping the songs into itunes...and i got about 3/4s of my music (about 25 gigs) and it starts to freezes when looking for album covers....if i force quit and reopen the song will be in there...just not the album work....which is fine....but if i have to force quit every time i import a song, its going to get rediculous....i have tried deleting the library and importing the "iTunes Music Library.xml" file about 6 times now, with the same results.....
    ALSO...when i connect my ipod to my computer (i have 80 gig 5G) it will freeze while syncing....
    i honestly have NO idea what to do....any suggestions would be welcomed...thanks....
    -Lisa

    modulatetome,
    See if these articles help to narrow down the issue:
    First: How to recreate your iTunes Library
    http://docs.info.apple.com/article.html?artnum=93313
    - You stated you had " deleted the library and imported "iTunes Music Library.xml", so verify steps in article are what you've done, or try them again.
    Second: How to open an alternate iTunes Library file or create a new one
    http://docs.info.apple.com/article.html?artnum=304447
    - You can use this to open iTunes with an empty Library, import one CD and test how iTunes works.
    Hope this helps,
    Generik
    Dual 2.3 GHz PowerPC G5   Mac OS X (10.4.8)  

  • Problem with my code!Please help:(

    Hi
    Here is the final code to read each byte at a time (using buffered input stream)from a remote sensed image and then store the values in 3 arrays . The image data (it is a remote-sensed image with 3 bands) are represented as a continuous byte stream band sequential. The format of the header is as follows:
    Bands (int)
    Rows (int)
    Cols (int)
    Bits-per-pixel (int)
    and then the image data follow.
    the code is:
    import java.io.*;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.Panel.*;
    import java.util.*;
    import java.awt.image.MemoryImageSource.*;
    public class Reader {
    public static void main (String args []){
    int numBands;
    int rows;
    int cols;
    int bpp;
    byte[] band1;
    byte[] band2;
    byte[] band3;
    try {
    FileInputStream fis = new FileInputStream ("BROM3.mar");
    BufferedInputStream bis = new BufferedInputStream (fis);
    DataInputStream dis = new DataInputStream (bis);
    numBands = dis.readInt();
    rows = dis.readInt();
    cols = dis.readInt();
    bpp = dis.readInt();
    if((dis.readByte() !='.') ||
    (dis.readByte() !='\r') ||
    (dis.readByte() !='.'))
    throw new Exception ("Bad format: end-of-header expected !");
    int nBytes = rows*cols*bpp/8;
    band1 = new byte[nBytes];
    band2 = new byte[nBytes];
    band3 = new byte[nBytes];
    for (int j=0; j<nBytes; j++) {
    band1[j] = dis.readByte();
    for (int j=0; j<nBytes; j++) {
    band2[j] = dis.readByte();
    for (int j=0; j<nBytes; j++) {
    band3[j] = dis.readByte();
    } catch (Exception e) {
    e.printStackTrace();}
    * Creates three objects of the ImagePanel class
    * and sets the size of both.
    ImagePanel panel1 = new ImagePanel() ;
    ImagePanel panel2 = new ImagePanel() ;
    ImagePanel panel3 = new ImagePanel() ;
    panel1.setSize (512,512);
    panel2.setSize (512,512);
    panel3.setSize (512,512);
    * Converts the 3 arrays into
    * images using the MemoryImageSource class and the Panel's
    * createImage method.
    Image green = panel1.createImage(new MemoryImageSource(512,512,band1[],0,512));
    Image blue = panel2.createImage(new MemoryImageSource(512,512,band2[],0,512));
    Image nir = panel1.createImage(new MemoryImageSource(512,512,band3[],0,512));
    * Displays the images.
    panel1.setDisplayImage (green);
    panel2.setDisplayImage (blue);
    panel3.setDisplayImage (nir);
    * Creates two Frame objects to display the panels in and
    * sets the size of both.
    Frame frame1 = new Frame ();
    frame1.setSize (512,512) ;
    frame1.add (panel1);
    Frame frame2 = new Frame();
    frame2.setSize (512,512);
    frame2.add (panel2);
    Frame frame3 = new Frame();
    frame3.setSize (512,512);
    frame3.add (panel3);
    * Makes the panels and the frames visible
    * and sets the location of the frames.
    panel1.setVisible (true);
    panel2.setVisible (true);
    panel3.setVisible (true);
    frame1.setVisible (true);
    frame1.setLocation (100,100);
    frame2.setVisible (true);
    frame2.setLocation (512,100);
    frame3.setVisible (true);
    frame3.setLocation (1024,100);
    } //End of main
    there is a problem especially in the MemoryImageSource bit.Can you please help me?
    Thank you very much
    Maria

    It usually helps to know what the problem is before trying to solve it. Perhaps you could tell us?

  • Having Problem with stuttering video. Please help!

    I haven't had a problem with viewing video online with my laptop until a few days ago. Now, all it will do is start to play, then freeze, play for a few seconds, then freeze, etc. etc. If I am on Hulu and pause the video to allow it to buffer, it will go good for a few minutes then start the same thing over again. I have done the same thing on CBS.com, but the results haven't been as good as on Hulu. I have noticed that it is considerably worse when the commercials start. I tried uninstalling my Flashplayer several times to no avail, and I even uninstalled my Antivirus and reinstalled that thinking that might be the problem. Tried right clicking on the player when it's in use and disableing the hardware accelerator in the settings, but that didn't help. I am about ready to pull my hair out!
    OS is Windows Vista Home Premium Service Pack 2
    Using Mozilla FireFox version3.6.8 and Internet Explorer 8 version 8.0.6001.18928
    Have Adobe Flashplayer version 10.1.53.64
    antivirus is Avast! Free version 5.0.594
    If there is any other info needed, let me know!

    is a video card problem for acne

  • N95 problems with mototrola S9 BT PLEASE HELP!!!!

    I have an N95 and am having real problems connecting with my motorola S9 headset.
    My software version is 11.0.026, 17-04-07, RM-159, 65.01 (not sure which numbers are relevant.
    The S9 connects with all my other phones.
    I assume its a software problem but if anyone has the same issue or a fix please help.
    o2-uk, N95 8GB
    V20.0.016, 28-02-08, RM-320, (88.01)
    Running Rotate Me 2.2 & Rock'n'Scroll & Shake SMS & ShakeLock & Flip Silent

    Will it never connect or the the connection closes afther a while?
    In the first case it can be two things.
    1. The headset has reached the maximum amound of connections. Max os often 7.
    2. The BT profiels are diffrent. Nothing you can do.
    If the connection closes it's your Nokia phone. The nokia profile difrens from the one of the motorola. The refresh time is difrent.
    Hope I helpt.
    Drunken

  • Problem with threads and simulation: please help

    please help me figure this out..
    i have something like this:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class DrawShapes extends JApplet{
         private JButton choices[];
         private String names[]={"line", "square", "oval"};
         private JPanel buttonPanel;
         private DrawPanel drawingArea;
         private int width=300, height=200;
         public void init(){
              drawingArea=new DrawPanel(width, height);
              choices=new JButton[names.length];
              buttonPanel=new JPanel();
              buttonPanel.setLayout(new GridLayout(1, choices.length));
              ButtonHandler handler=new ButtonHandler();
              for(int i=0; i<choices.length; i++){
                   choices=new JButton(names[i]);
                   buttonPanel.add(choices[i]);
                   choices[i].addActionListener(handler);
              Container c=getContentPane();
              c.add(buttonPanel, BorderLayout.NORTH);
              c.add(drawingArea, BorderLayout.CENTER);
         }//end init
         public void setWidth(int w){
              width=(w>=0 ? w : 300);
         public void setHeight(int h){
              height=(h>=0 ? h : 200);
         /*public static void main(String args[]){
              int width, height;
              if(args.length!=2){
                   height=200; width=300;
              else{
                        width=Integer.parseInt(args[0]);
                        height=Integer.parseInt(args[1]);
              JFrame appWindow=new JFrame("An applet running as an application");
              appWindow.addWindowListener(
                   new WindowAdapter(){
                        public void windowClosing(WindowEvent e){
                             System.exit(0);
              DrawShapes appObj=new DrawShapes();
              appObj.setWidth(width);
              appObj.setHeight(height);
              appObj.init();          
              appObj.start();
              appWindow.getContentPane().add(appObj);
              appWindow.setSize(width, height);
              appWindow.show();
         }//end main*/
         private class ButtonHandler implements ActionListener{
              public void actionPerformed(ActionEvent e){
                   for(int i=0; i<choices.length; i++){
                        if(e.getSource()==choices[i]){
                             drawingArea.setCurrentChoice(i);
                             break;
    }//end class DrawShapes
    class DrawPanel extends JPanel{
         private int currentChoice=-1;
         private int width=100, height=100;
         public DrawPanel(int w, int h){
              width=(w>=0 ? w : 100);
              height=(h>=0 ? h : 100);
         public void paintComponent(Graphics g){
              super.paintComponent(g);
              switch(currentChoice){
                   case 0:     g.drawLine(randomX(), randomY(), randomX(), randomY());
                             break;
                   case 1: g.drawRect(randomX(), randomY(), randomX(), randomY());
                             break;
                   case 2: g.drawOval(randomX(), randomY(), randomX(), randomY());
                             break;
         public void setCurrentChoice(int c){
              currentChoice=c;
              repaint();          
         private int randomX(){
              return (int) (Math.random()*width);
         private int randomY(){
              return (int) (Math.random()*height);
    }//end class drawPanel
    That one's from a book. I used that code to start with my applet. Mine calls different merthod from the switch cases. Say I have:
    case 0: drawStart(g); break;
    public void drawStart(Graphics g){
      /* something here */
    drawMain(g);
    public void drawMain(graphics g){
    g.drawString("test", x, y);
    //here's where i'm trying to pause
    //i've tried placing Thread.sleep between these lines
    g.drawLine(x, y, a, b);
    //Thread.sleep here
    g.drawRect(x, y, 50, 70);
    }I also need to put delays between method calls but I need to synchronize them. Am I doing it all wrong? The application pauses or sleeps but afterwards, it still drew everything all at once. Thanks a lot!

    It is. Sorry about that. Just answer any if you want to. I'd appreciate your help. Sorry again if it caused you anything or whatever. .n_n.

  • Problem with interputting  accessframe  example please help!!!

    A use code bellow to access every frame in the movie :
    import java.awt.*;
    import javax.media.*;
    import javax.media.control.TrackControl;
    import javax.media.Format;
    import javax.media.format.*;
    import java.io.*;
    import javax.imageio.*;
    import javax.imageio.stream.*;
    import java.awt.Color.*;
    import java.awt.image.*;
    import java.util.*;
    import java.awt.image.*;
    import javax.media.util.*;
    import javax.swing.JFrame;
    public class Film2ramki implements ControllerListener {
    Processor p;
    Object waitSync = new Object();
    boolean stateTransitionOK = true;
    public boolean alreadyPrnt = false;
    public void zakoncz(){
         p.stop();
         p.close();
         p.deallocate();
    public boolean open(MediaLocator ml) {
    try {
    p = Manager.createProcessor(ml);
    } catch (Exception e) {
    System.err.println("Failed to create a processor from the given url: " + e);
    return false;
    p.addControllerListener(this);
    // Put the Processor into configured state.
    p.configure();
    if (!waitForState(p.Configured)) {
    System.err.println("Failed to configure the processor.");
    return false;
    // So I can use it as a player.
    p.setContentDescriptor(null);
    // Obtain the track controls.
    TrackControl tc[] = p.getTrackControls();
    if (tc == null) {
    System.err.println("Failed to obtain track controls from the processor.");
    return false;
    // Search for the track control for the video track.
    TrackControl videoTrack = null;
    for (int i = 0; i < tc.length; i++) {
    if (tc.getFormat() instanceof VideoFormat) {
    videoTrack = tc[i];
    break;
    if (videoTrack == null) {
    System.err.println("The input media does not contain a video track.");
    return false;
    System.err.println("Video format: " + videoTrack.getFormat());
    // Instantiate and set the frame access codec to the data flow path.
    try {
    Codec codec[] = { new PreAccessCodec(),
    new PostAccessCodec()};
    videoTrack.setCodecChain(codec);
    } catch (UnsupportedPlugInException e) {
    System.err.println("The process does not support effects.");
    // Realize the processor.
    p.prefetch();
    if (!waitForState(p.Prefetched)) {
    System.err.println("Failed to realize the processor.");
    return false;
    p.start();
    return true;
    boolean waitForState(int state) {
    synchronized (waitSync) {
    try {
    while (p.getState() != state && stateTransitionOK)
    waitSync.wait();
    } catch (Exception e) {}
    return stateTransitionOK;
    public void controllerUpdate(ControllerEvent evt) {
    if (evt instanceof ConfigureCompleteEvent ||
    evt instanceof RealizeCompleteEvent ||
    evt instanceof PrefetchCompleteEvent) {
    synchronized (waitSync) {
    stateTransitionOK = true;
    waitSync.notifyAll();
    } else if (evt instanceof ResourceUnavailableEvent) {
    synchronized (waitSync) {
    stateTransitionOK = false;
    waitSync.notifyAll();
    } else if (evt instanceof EndOfMediaEvent) {
         p.stop();
         p.close();
         System.exit(0);
    Film2ramki(){}
    public void startnow (String plik) {
         //this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
    String url = "file:"+plik;
    if (url.indexOf(":") < 0) {
    prUsage();
    System.exit(0);
    MediaLocator ml;
    if ((ml = new MediaLocator(url)) == null) {
    System.err.println("Cannot build media locator from: " + url);
    System.exit(0);
    if (!open(ml))
    System.exit(0);
    static void prUsage() {
    System.err.println("Usage: java Film2ramki <url>");
    * Inner class.
    * A pass-through codec to access to individual frames.
    public class PreAccessCodec implements Codec {
    * Callback to access individual video frames.
    void accessFrame(Buffer frame) {
    // For demo, we'll just print out the frame #, time &
    // data length.
    long t = (long)(frame.getTimeStamp()/10000000f);
    System.err.println("Pre: frame #: " + frame.getSequenceNumber() +
    ", time: " + ((float)t)/100f +
    ", len: " + frame.getLength());
    * The code for a pass through codec.
    // We'll advertize as supporting all video formats.
    protected Format supportedIns[] = new Format [] {
    new VideoFormat(null)
    // We'll advertize as supporting all video formats.
    protected Format supportedOuts[] = new Format [] {
    new VideoFormat(null)
    Format input = null, output = null;
    public String getName() {
    return "Pre-Access Codec";
    // No op.
    public void open() {
    // No op.
    public void close() {
    // No op.
    public void reset() {
    public Format [] getSupportedInputFormats() {
    return supportedIns;
    public Format [] getSupportedOutputFormats(Format in) {
    if (in == null)
    return supportedOuts;
    else {
    // If an input format is given, we use that input format
    // as the output since we are not modifying the bit stream
    // at all.
    Format outs[] = new Format[1];
    outs[0] = in;
    return outs;
    public Format setInputFormat(Format format) {
    input = format;
    return input;
    public Format setOutputFormat(Format format) {
    output = format;
    return output;
    public int process(Buffer in, Buffer out) {
    // This is the "Callback" to access individual frames.
    accessFrame(in);
    // Swap the data between the input & output.
    Object data = in.getData();
    in.setData(out.getData());
    out.setData(data);
    // Copy the input attributes to the output
    out.setFlags(Buffer.FLAG_NO_SYNC);
    out.setFormat(in.getFormat());
    out.setLength(in.getLength());
    out.setOffset(in.getOffset());
    return BUFFER_PROCESSED_OK;
    public Object[] getControls() {
    return new Object[0];
    public Object getControl(String type) {
    return null;
    public class PostAccessCodec extends PreAccessCodec {
    // We'll advertize as supporting all video formats.
    public PostAccessCodec() {
    supportedIns = new Format [] {
    new RGBFormat()
    * Callback to access individual video frames.
    void accessFrame(Buffer frame) {
    // For demo, we'll just print out the frame #, time &
    // data length.
    if(!alreadyPrnt)
    BufferToImage stopBuffer = new BufferToImage((VideoFormat)frame.getFormat());
    System.out.println(stopBuffer.toString());
    System.out.println("CreatedBuffer");
    System.out.println("Created stopImage");
    Image stopImage = stopBuffer.createImage(frame);
    System.out.println("stopImage is full");
    if(stopImage == null)
    System.out.println("stopImage is null");
    try
    BufferedImage outImage = new BufferedImage (320, 240,BufferedImage.TYPE_INT_RGB);
    Graphics og = outImage.getGraphics();
    og.drawImage(stopImage,0,0,320,240,null);
    //prepareImage(outImage,rheight,rheight, null);
    Iterator writers = ImageIO.getImageWritersByFormatName("jpg");
    ImageWriter writer = (ImageWriter)writers.next();
    //Once an ImageWriter has been obtained, its destination must be set to an ImageOutputStream:
    File f = new File("frames\\"+frame.getSequenceNumber() + ".jpg");
    ImageOutputStream ios = ImageIO.createImageOutputStream(f);
    writer.setOutput(ios);
    //Finally, the image may be written to the output stream:
    //BufferedImage bi;
    //writer.write(imagebi);
    writer.write(outImage);
    ios.close();
    catch(IOException e)
    System.out.println("Error :" + e);
    //alreadyPrnt = true;
    long t = (long)(frame.getTimeStamp()/10000000f);
    System.err.println("Post: frame #: " + frame.getSequenceNumber() +
    ", time: " + ((float)t)/100f +
    ", len: " + frame.getLength());
    if(frame.getLength()==0){p.stop();p.close();p.deallocate();}
    public String getName() {
    return "Post-Access Codec";
    this code capture every frame from movie but it never ends running and i can't invoke any metod after grabing frames becouse its still running. How Can I stop this to enter the next metod.
    Please help me
    thx

    Answering sam04 question Yes this make that every frame is captured
    Back to my problem :
    I invoke caputre frames class from other class like this:
    Film2ramki f2r=new Film2ramki();
    f2r.startnow(pathtomov);
    System.out.println("End of capture");...........................
    So when capturing frames ends it should print "End of caputre" but I get something like this :
    JPEG, 320x240, FrameRate=13.0, Length=18198
    Video format: JPEG, 320x240, FrameRate=13.0, Length=18198
    Pre: frame #: 1, time: 0.0, len: 16282
    Post: frame #: 1, time: 0.0, len: 230400
    End of capture
    Pre: frame #: 2, time: 0.07, len: 16471
    Post: frame #: 2, time: 0.07, len: 230400
    Pre: frame #: 3, time: 0.15, len: 16620
    Post: frame #: 3, time: 0.15, len: 230400
    Pre: frame #: 4, time: 0.23, len: 16541
    Post: frame #: 4, time: 0.23, len: 230400
    Pre: frame #: 5, time: 0.3, len: 16749
    Pre: frame #: 18, time: 1.3, len: 15708
    Post: frame #: 18, time: 1.3, len: 230400
    Pre: frame #: 18, time: 1.3, len: 0
    Post: frame #: 18, time: 1.3, len: 0this is strange becouse it captures 1 frame end print "End of capture" and then its capures other frames. Why ?????

  • Problem with Logic XS Key, PLEASE HELP

    I use my G4 Powerbook laptop for live. I am running most recent version of logic.
    What happens is that Logic will load up fine, but then for no apparent reason logic will come up with an error message saying that the logic key has been removed, but i have not touched it!! I then have to restart logic.
    PLease help i have to get this sorted ASAP cuz i have a gig tomorrow nite. Cheers guys

    Hmm, it does it on both USB ports? And you haven't noticed any problems with other USB gear on those ports?
    When the key is next not recognised by Logic, go into the system profiler and find your USB port that the XS key is on - the XS key will be labelled when it's functioning correctly. Is it still recognised by the computer, or has it gone completely?

Maybe you are looking for