mOriginFile.open(AS400File.READ_WRITE, 0,
AS400File.COMMIT_LOCK_LEVEL_NONE);
// Read all records in the file into
// a string - each one separated by the Constants.LINE_SEPARATOR
Record record = mOriginFile.readNext();
if (record != null)
{ // at least one record
byte[] inData = null;
// save record contents to the byte array
inData = record.getContents();
// convert this content to the String
mConverter = new CharConverter(mEncoding);
retBuffer.append(mConverter.byteArrayToString(inData));
while ((record = mOriginFile.readNext()) != null)
{
// read records while they exist
retBuffer.append(Constants.LINE_SEPERATOR);
inData = record.getContents();
retBuffer.append(mConverter.byteArrayToString(inData));
} // while ((record = mOriginFile.readNext()) != null)
} // if (record != null)
// close the file since I am done
mOriginFile.close();