Hello, I've opened a file (code below) containing file names onto a FileInputStream , and attempting to open each file and place its contents onto a FileOutputStrea m (or buffer) and need help getting it accomplished.
I am developing the application for a Capstone project at school...where we are developing a:
- Consumer Financial Software System (personal
finance manager)
I am using Java's j2sdk1.4.2_12 on Windows XP
The embolden part of the code is where I like to begin a loop and iterate/cycle through the files on
the FileInputStream (indexFile); having the loop open the file and place it onto a FileOutputStrea m.
(Thanks)
The code is:
I am developing the application for a Capstone project at school...where we are developing a:
- Consumer Financial Software System (personal
finance manager)
I am using Java's j2sdk1.4.2_12 on Windows XP
The embolden part of the code is where I like to begin a loop and iterate/cycle through the files on
the FileInputStream (indexFile); having the loop open the file and place it onto a FileOutputStrea m.
(Thanks)
The code is:
Code:
//Program Consumer Financial Software System (Capstone Project)
//File: CfssAcctSubPanel.java
import java.io.*;
import java.awt.*;
import java.lang.*;
import java.util.*;
import java.awt.event.*; // for WindowEvent, ItemEvent, ActionEvent;
import java.awt.event.WindowAdapter;
import javax.swing.*; //for JFrame, JComboBox, JList, JLabel
import javax.swing.event.*;
public class CfssAcctSubPanel extends JPanel
{
//Create a Vector object, which is a dynamic array that hold objects.
private static Vector acctList = new Vector();
private JComboBox acctsCombo;
private JList casp1List, casp2List;
private JLabel caspAcctLbl = new JLabel("Account");
private JLabel caspTrnsLbl = new JLabel("Transaction");
private JLabel casp2BalLbl = new JLabel("Balance");
private JLabel casp2ValLbl = new JLabel("Value");
public CfssAcctSubPanel()
{
String strAcct = "Accounts";
String strMasIndex = "MasterAccountsIndex";
// int size5 = 180;
try {
// Extracting username from logonExist file
FileInputStream username = new FileInputStream( "logonExist");
int size = username.available();
byte userArray[] = new byte[size];
username.read( userArray);
username.close();
String login = new String(userArray);
// MasterAccountsIndex file directory
File userDir = new File(login + "/" + strAcct + "/" + strMasIndex);
System.out.println(userDir);
[B] // MasterAccountsIndex file listing array (indexArray)
FileInputStream indexFile = new FileInputStream(userDir);
int size2 = indexFile.available();
byte indexArray[] = new byte[size2];
indexFile.read( indexArray);
System.out.println(new String(indexArray));
indexFile.close();
[/B]
}
catch(FileNotFoundException fnfe)
{
System.out.println("Can't find the file:" + strMasIndex);
}
catch(IOException ioe)
{
System.out.println("Problem reading the file!");
}
}
}
Comment