aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes URLyBird 1.2.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "URLyBird 1.2.1" Watch "URLyBird 1.2.1" New topic
Author

URLyBird 1.2.1

paolo rico
Greenhorn

Joined: Mar 07, 2004
Posts: 5
Hi All !

I have a question about reading from flat file ,

byte[] input = new byte[4];
synchronized (database) {
database.seek(0); // Seek to start point of file
database.readFully(input);
}

The result of input value [0,0,1,1] if i convert this to int the values is 257 ? Is that my magic number !

Do i need to keep add to seek() to start from next position or can i just go direct to the datapart ?

I have seen other post using

class RecordFieldReader {
private int offset = 0;
String read(int length) throws UnsupportedEncodingException {
String str = new String(input, offset, length, "ISO-8859-1");
offset += length;
return str.trim();
}
}
paolo rico
Greenhorn

Joined: Mar 07, 2004
Posts: 5
If i start reading from row 74 where the data starts , is it okey to just read from row 74 ? It does not say much about if magic cookie is required or dynamic read the schema .


[74,0] = // If row is deleted or not
[74,1] = Palace //Name
[74,2] = Smallville //location
[74,3] = 2 //occupancy
[74,4] = Y //Smoking
[74,5] = $150.00 //Price
[74,6] = 2005/07/27 //Date
[74,7] = //Owner
234 160
[234,0] =
[234,1] = Castle
[234,2] = Smallville
[234,3] = 6
[234,4] = Y
[234,5] = $220.00
[234,6] = 2005/11/19
[234,7] =
394 160
[394,0] =
[394,1] = Excelsior
[394,2] = Smallville
[394,3] = 4
[394,4] = Y
[394,5] = $230.00
[394,6] = 2003/02/05
[394,7] =
554 160
[554,0] =
[554,1] = Palace
[554,2] = Whoville
[554,3] = 6
[554,4] = N
[554,5] = $110.00
[554,6] = 2005/09/11
[554,7] =
714 160
[714,0] =
[714,1] = Bed & Breakfast & Business
[714,2] = Whoville
[714,3] = 2
[714,4] = Y
[714,5] = $100.00
[714,6] = 2005/08/07
[714,7] =
874 160
[874,0] =
[874,1] = Grandview
[874,2] = Whoville
[874,3] = 6
[874,4] = Y
[874,5] = $210.00
[874,6] = 2003/06/10
[874,7] =
1034 160
[1034,0] =
[1034,1] = Dew Drop Inn
[1034,2] = Metropolis
[1034,3] = 4
[1034,4] = Y
[1034,5] = $240.00
[1034,6] = 2005/11/17
[1034,7] =
1194 160
[1194,0] =
[1194,1] = Excelsior
[1194,2] = Metropolis
[1194,3] = 6
[1194,4] = Y
[1194,5] = $140.00
[1194,6] = 2005/02/28
[1194,7] =
1354 160
[1354,0] =
[1354,1] = Pandemonium
[1354,2] = Pleasantville
[1354,3] = 4
[1354,4] = N
[1354,5] = $250.00
[1354,6] = 2004/12/02
[1354,7] =
1514 160
[1514,0] =
[1514,1] = Dew Drop Inn
[1514,2] = Pleasantville
[1514,3] = 6
[1514,4] = N
[1514,5] = $160.00
[1514,6] = 2005/03/04
[1514,7] =
1674 160
[1674,0] =
[1674,1] = Dew Drop Inn
[1674,2] = Digitopolis
[1674,3] = 4
[1674,4] = N
[1674,5] = $190.00
[1674,6] = 2005/09/17
[1674,7] =
1834 160
[1834,0] =
[1834,1] = Castle
[1834,2] = Digitopolis
[1834,3] = 4
[1834,4] = N
[1834,5] = $90.00
[1834,6] = 2004/01/17
[1834,7] =
1994 160
[1994,0] =
[1994,1] = Bed & Breakfast & Business
[1994,2] = Digitopolis
[1994,3] = 6
[1994,4] = Y
[1994,5] = $250.00
[1994,6] = 2003/09/15
[1994,7] =
2154 160
[2154,0] =
[2154,1] = Bed & Breakfast & Business
[2154,2] = Atlantis
[2154,3] = 4
[2154,4] = N
[2154,5] = $110.00
[2154,6] = 2003/09/03
[2154,7] =
2314 160
[2314,0] =
[2314,1] = Excelsior
[2314,2] = Atlantis
[2314,3] = 6
[2314,4] = Y
[2314,5] = $230.00
[2314,6] = 2004/04/05
[2314,7] =
2474 160
[2474,0] =
[2474,1] = Grandview
[2474,2] = Atlantis
[2474,3] = 4
[2474,4] = N
[2474,5] = $110.00
[2474,6] = 2004/05/04
[2474,7] =
2634 160
[2634,0] =
[2634,1] = Elephant Inn
[2634,2] = EmeraldCity
[2634,3] = 6
[2634,4] = Y
[2634,5] = $110.00
[2634,6] = 2003/07/28
[2634,7] =
2794 160
[2794,0] =
[2794,1] = Splendide
[2794,2] = EmeraldCity
[2794,3] = 6
[2794,4] = N
[2794,5] = $120.00
[2794,6] = 2003/06/10
[2794,7] =
2954 160
[2954,0] =
[2954,1] = Castle
[2954,2] = EmeraldCity
[2954,3] = 4
[2954,4] = Y
[2954,5] = $150.00
[2954,6] = 2003/05/15
[2954,7] =
3114 160
[3114,0] =
[3114,1] = Splendide
[3114,2] = Bali Hai
[3114,3] = 6
[3114,4] = Y
[3114,5] = $100.00
[3114,6] = 2005/04/06
[3114,7] =
3274 160
[3274,0] =
[3274,1] = Pandemonium
[3274,2] = Bali Hai
[3274,3] = 4
[3274,4] = Y
[3274,5] = $150.00
[3274,6] = 2003/08/01
[3274,7] =
3434 160
[3434,0] =
[3434,1] = Grandview
[3434,2] = Xanadu
[3434,3] = 6
[3434,4] = N
[3434,5] = $150.00
[3434,6] = 2003/08/02
[3434,7] =
3594 160
[3594,0] =
[3594,1] = Pandemonium
[3594,2] = Xanadu
[3594,3] = 2
[3594,4] = N
[3594,5] = $130.00
[3594,6] = 2004/08/07
[3594,7] =
3754 160
[3754,0] =
[3754,1] = Castle
[3754,2] = Paravel
[3754,3] = 4
[3754,4] = N
[3754,5] = $220.00
[3754,6] = 2004/09/14
[3754,7] =
3914 160
[3914,0] =
[3914,1] = Splendide
[3914,2] = Paravel
[3914,3] = 4
[3914,4] = N
[3914,5] = $110.00
[3914,6] = 2004/03/14
[3914,7] =
4074 160
[4074,0] =
[4074,1] = Palace
[4074,2] = Hobbiton
[4074,3] = 4
[4074,4] = N
[4074,5] = $90.00
[4074,6] = 2003/09/22
[4074,7] =
4234 160
[4234,0] =
[4234,1] = Grandview
[4234,2] = Hobbiton
[4234,3] = 4
[4234,4] = Y
[4234,5] = $110.00
[4234,6] = 2004/01/03
[4234,7] =
4394 160
[4394,0] =
[4394,1] = Excelsior
[4394,2] = Hobbiton
[4394,3] = 4
[4394,4] = N
[4394,5] = $110.00
[4394,6] = 2005/06/23
[4394,7] =
4554 160
[4554,0] =
[4554,1] = Castle
[4554,2] = Lendmarch
[4554,3] = 4
[4554,4] = N
[4554,5] = $140.00
[4554,6] = 2003/09/17
[4554,7] =
4714 160
[4714,0] =
[4714,1] = Pandemonium
[4714,2] = Lendmarch
[4714,3] = 6
[4714,4] = Y
[4714,5] = $230.00
[4714,6] = 2004/05/02
[4714,7] =
4874 160
[4874,0] =
[4874,1] = Grandview
[4874,2] = Lendmarch
[4874,3] = 4
[4874,4] = N
[4874,5] = $170.00
[4874,6] = 2003/11/12
[4874,7] =
[ November 18, 2008: Message edited by: paolo rico ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: URLyBird 1.2.1