• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in framing or understanding the exact approach for the given specification

 
Ranch Hand
Posts: 136
Android Eclipse IDE Windows XP
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi , I got a task to create a java program , but actually I am not able to understand what I need to do . I mean , there are some Filie System , flat file scenarios and space given . So please explain me what exactly I need to code and what is the actual requirement. The problem given as-
**I do not need the entire code .

A specification for a very simple file system stored inside a flat file (FS). There is an associated index file (FI) which
provides meta-data to the data inside the flat file (FS).

/* What is this FS and FI and what should I code here*/

FS:- FS cannot be larger than 1 MB. The entire space in FS is divided into blocks of 128 bytes.

/* FI details is given , but actually what they want me to code */
FI:- FI provides meta-data regarding what is stored in FS. Directories, sub-directories and files are supported. Files can be
binary or text which is marked in the meta-data. The following is a detailed description of FI –
FI consists of a sequence of entries or records. Each record (Record) is 48 bytes long. Each record has an index and is referred
by its index. There can be a max 8192 Records if each file is exactly one block long. Therefore FI can be at most 8192 x 48 =
~384KB in size. The structure of each Record is –

1 2 3 4 5
|-----------------|--|--|---|-------|

1 – Name (32 bytes)
2 – Attribs (2 bytes) Described below
3 – Directory Entry (2 bytes) – what is the parent directory of this record
4 – Size (4 bytes) – File size, 0 for Directory
5 – Blocks list (8 bytes)

Name – The file/dir name can be at most 32 bytes long. Only ascii alpha-numeric characters are allowed.
The only symbols allowed are - $ and .
A string shorter than 32 characters is terminated with an ascii value of 0.

Attributes – Only the relevant attributes are described here
1st bit – if set is a File else Dir
3rd bit – if set is a Text file else Binary

Dir Entry – The index of the parent’s Record in FI. The root entry has this value as 0.

Size – The actual size of the file (not the block count), always 0 for directories

Blocks list – Lists which blocks in FS holds the contents of this record. 8 bytes allows for 4 block indices to be specified
each of size 2 bytes. If a file is larger than 4 block sizes (i.e. larger than 512 bytes) then a chaining mechanism is used
where the last 2 bytes of the block from FD is used to point to the next block in FS. Suppose if the file is of 8 block
size, then the last 2 bytes of 4th block will point to 5th block and last 2 bytes of 5th block points to 6th block and so on.
Directories will not have any block entries.
The root directory always occupies Record[0].


/*If I only need to code the given problem , I can code but FI and FS is really creating a big problem*/
Problem
A] Write a class com.progress.test.FSReader which has a static read method and takes as its only argument a file path similar
to \files\abc.txt and returns a String of its contents.
If the path provided is not a file or not a text file null must be returned. No exceptions must be thrown.
Signature -> String com.progress.test.FSReader.read(String path)



Please explain me exactly what I need to code.
Thanks in advance.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, what is exactly the problem, you don't understand what "FS" and "FI" are? I guess FS stands for File System and FI for File Index. The whole assignment explains what those things are - FS is just a block of data, which can at most be 1 MB, and FI is a data structure that describes files in this little toy file system.

Are you doing a course? Ask your professor or course leader or your fellow students to explain it to you.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like you're emulating a simplistic file system. I'm not sure where you're having a problem--perhaps if you ask a specific question, or post what code you have so far.
 
buntha Choudhary
Ranch Hand
Posts: 136
Android Eclipse IDE Windows XP
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually I was not understanding that FI and FS were just an explanation.
I was thinking that I need to code or create a program of FI and FS .

Thanks .
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You do, or at least could.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey bro..I also got a similar assignment, but I got the files FI.txt and FS.txt with it, which has the file structure and the file itself. Did you get that too?

Additionally I have been asked to send the output for file path \Progress\OpenEdge\OpenEdge.txt along with Source code.

I think there is some problem with the files that I got. No matter what path I enter the content is blank.

Did you too get the files FI.txt and FS.txt, can you please mail me yours at dceashish@gmail.com
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please BeForthrightWhenCrossPostingToOtherSites:

http://forums.sun.com/thread.jspa?threadID=5433502
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From where are you getting this problem?
 
Ashishh Rawat
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got this as part of a screening exercise of a company. Have to submit the code within two days. I didn't find the problem too complex, except that I couldn't get the right output
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess it was complex enough, then.

Do you think it's ethical for us to help you write code that will help someone else decide whether or not to give you a job?

If I found out that someone I was hiring didn't do all the work themselves I would immediately eliminate them as a possible candidate.
 
Ashishh Rawat
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Quite true. But the fact is that I never asked anyone to write my code. I feel that the sample files I got to test my program somehow got corrupted. So, I am asking the owner of this post to send me the test files so that I can verify if that is the problem.
 
reply
    Bookmark Topic Watch Topic
  • New Topic