Skip to content

Commit

Permalink
Merge pull request iryndin#2 from bugy/master
Browse files Browse the repository at this point in the history
Minor improvements
  • Loading branch information
iryndin committed May 12, 2014
2 parents 3be5dbb + 8f3ed84 commit 93cf054
Show file tree
Hide file tree
Showing 5 changed files with 544 additions and 473 deletions.
75 changes: 40 additions & 35 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
<project name="jdbf" default="jar" basedir=".">

<description>jdbf - Java library to write/read DBF files</description>

<property name="src.dir" location="${basedir}/src" />
<property name="build.dir" location="${basedir}/build" />
<property name="src.generated.dir" location="${build.dir}/java_generated_${version.tag}" />
<property name="classes.dir" location="${build.dir}/classes"/>
<property name="dist.dir" location="${build.dir}/dist"/>
<property name="jar.filename" location="${dist.dir}/jdbf.jar"/>

<path id="main.classpath">
<pathelement path="${classes.dir}" />
</path>

<target name="mkdirs">
<mkdir dir="${build.dir}" />
<mkdir dir="${classes.dir}" />
<mkdir dir="${dist.dir}" />
</target>

<target name="clean">
<delete dir="${build.dir}" />
</target>

<target name="compile" description="compile the source" depends="clean,mkdirs">
<javac destdir="${classes.dir}" debug="true">
<src path="${src.dir}"/>
<classpath refid="main.classpath" />
</javac>
</target>

<target name="jar" description="Create JAR file" depends="compile">
<jar destfile="${jar.filename}" basedir="${classes.dir}"/>
</target>


<description>jdbf - Java library to write/read DBF files</description>

<property name="src.dir" location="${basedir}/src"/>
<property name="build.dir" location="${basedir}/build"/>
<property name="src.generated.dir" location="${build.dir}/java_generated_${version.tag}"/>
<property name="classes.dir" location="${build.dir}/classes"/>
<property name="dist.dir" location="${build.dir}/dist"/>
<property name="jar-name" value="jdbf"/>
<property name="jar.filename" value="${jar-name}.jar"/>
<property name="src-zip.filename" value="${jar-name}-src.zip"/>

<path id="main.classpath">
<pathelement path="${classes.dir}"/>
</path>

<target name="mkdirs">
<mkdir dir="${build.dir}"/>
<mkdir dir="${classes.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>

<target name="clean">
<delete dir="${build.dir}"/>
</target>

<target name="compile" description="compile the source" depends="clean,mkdirs">
<javac destdir="${classes.dir}" debug="true">
<src path="${src.dir}"/>
<classpath refid="main.classpath"/>
</javac>
</target>

<target name="jar" description="Create JAR file" depends="compile">
<jar destfile="${dist.dir}/${jar.filename}" basedir="${classes.dir}"/>

<zip zipfile="${dist.dir}/${src-zip.filename}" basedir="${basedir}/src"
compress="true"/>
</target>

</project>
71 changes: 36 additions & 35 deletions src/net/iryndin/jdbf/core/DbfFieldTypeEnum.java
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
package net.iryndin.jdbf.core;

public enum DbfFieldTypeEnum {
Character('C'),
Currency('Y'),
Numeric('N'),
Float('F'),
Date('D'),
DateTime('T'),
Double('B'),
Integer('I'),
Logical('L'),
Memo('M'),
General('G'),
Picture('P');

final char type;

DbfFieldTypeEnum(char type) {
this.type= type;
}

public static DbfFieldTypeEnum fromChar(char type) {
for (DbfFieldTypeEnum e : DbfFieldTypeEnum.values()) {
if (e.type == type) {
return e;
}
}
return null;
}

public byte toByte() {
return (byte)type;
}

public char getType() {
return type;
}
Character('C'),
Currency('Y'),
Numeric('N'),
Float('F'),
Date('D'),
DateTime('T'),
Double('B'),
Integer('I'),
Logical('L'),
Memo('M'),
General('G'),
Picture('P'),
NullFlags('0');

final char type;

DbfFieldTypeEnum(char type) {
this.type = type;
}

public static DbfFieldTypeEnum fromChar(char type) {
for (DbfFieldTypeEnum e : DbfFieldTypeEnum.values()) {
if (e.type == type) {
return e;
}
}
return null;
}

public byte toByte() {
return (byte) type;
}

public char getType() {
return type;
}
}
Loading

0 comments on commit 93cf054

Please sign in to comment.