fixed-length-file

Is there an smart way to write a fixed length flat file?

风格不统一 提交于 2019-12-22 03:23:11
问题 Is there any framework/library to help writing fixed length flat files in java? I want to write a collection of beans/entities into a flat file without worrying with convertions, padding, alignment, fillers, etcs For example, I'd like to parse a bean like: public class Entity{ String name = "name"; // length = 10; align left; fill with spaces Integer id = 123; // length = 5; align left; fill with spaces Integer serial = 321 // length = 5; align to right; fill with '0' Date register = new Date

sqlplus spooling: How to get rid of first, empty line?

北慕城南 提交于 2019-12-18 12:59:14
问题 I'm doing the following spooling statement: SET VERIFY OFF SET FEEDBACK OFF SET HEADING OFF SET TRIMSPOOL ON SET TERM OFF SPOOL &pathRelations START scripts/relations.sql &parent SPOOL OFF SET TERM ON The scripts/relations.sql file contains a simple select statement. Unfortunately, the spooled file contains an empty line as the first one in the file. This line causes trouble in our framework. Of course I could get rid of these line through sed but ain't there a way to suppress its creation in

Reading data from Fixed Length File into class objects

北城余情 提交于 2019-12-12 09:03:31
问题 I have a fixed length file and would like to read its data into class objects. These objects will be further used to insert/update data in Database. Although it can be done with StreamReader, I am looking for a more sophisticated solution. FileHelper is another solution but I do not want to use an open source code in my program. Is there any other option? In the below link, one user has answered this similar question but it is not elaborated: https://codereview.stackexchange.com/questions

Dynamically create a Fixed Length text file with FileHelpers

谁都会走 提交于 2019-12-11 12:29:45
问题 FileHelpers supports a feature called "RunTime Records" which lets you read a Fixed length text file into a DataTable when you don't know the layout until runtime. Is it possible to use FileHelpers to export a Fixed length file at runtime in the same manner? 回答1: Here's a working sample for export using a DataTable as source. public static class DataTableExtensions { public static List<object> DataTableToList(this DataTable table, Type type) { List<object> list = new List<object>(); foreach

Is there an smart way to write a fixed length flat file?

主宰稳场 提交于 2019-12-05 01:13:52
Is there any framework/library to help writing fixed length flat files in java? I want to write a collection of beans/entities into a flat file without worrying with convertions, padding, alignment, fillers, etcs For example, I'd like to parse a bean like: public class Entity{ String name = "name"; // length = 10; align left; fill with spaces Integer id = 123; // length = 5; align left; fill with spaces Integer serial = 321 // length = 5; align to right; fill with '0' Date register = new Date();// length = 8; convert to yyyyMMdd } ... into ... name 123 0032120110505 mikhas 5000 0122120110504

Reading data from Fixed Length File into class objects

╄→гoц情女王★ 提交于 2019-12-04 17:17:23
I have a fixed length file and would like to read its data into class objects. These objects will be further used to insert/update data in Database. Although it can be done with StreamReader, I am looking for a more sophisticated solution. FileHelper is another solution but I do not want to use an open source code in my program. Is there any other option? In the below link, one user has answered this similar question but it is not elaborated: https://codereview.stackexchange.com/questions/27782/how-to-read-fixed-width-data-fields-in-net I tried to implement this but I am unable to find Layout(

sqlplus spooling: How to get rid of first, empty line?

孤人 提交于 2019-11-30 08:27:31
I'm doing the following spooling statement: SET VERIFY OFF SET FEEDBACK OFF SET HEADING OFF SET TRIMSPOOL ON SET TERM OFF SPOOL &pathRelations START scripts/relations.sql &parent SPOOL OFF SET TERM ON The scripts/relations.sql file contains a simple select statement. Unfortunately, the spooled file contains an empty line as the first one in the file. This line causes trouble in our framework. Of course I could get rid of these line through sed but ain't there a way to suppress its creation in the first place? Tagar SET NEWPAGE NONE is the correct answer. SET NEWPAGE 0 will cause a page feed,