Package org.xBaseJ.micro

Examples of org.xBaseJ.micro.xBaseJException


  String value = inValue.trim();
  if (value.length() == 0)
    value = "F";
  if (value.length() != 1)
      throw new xBaseJException("Field length incorrect");
  put(value.charAt(0));

  }
View Full Code Here


     case 'f':
     case '0':
        buffer[0] = BYTEFALSE;
        break;
     default:
            throw new xBaseJException("Invalid logical Field value");
    }
  }
View Full Code Here

      for (i = 0; i<8; i++) { buffer[i] = blankbyte; }
      return;
     }

  if (inValue.length() != 8)
     throw new xBaseJException("Invalid length for date Field");

  for (i = 0; i<8; i++) {
  if (Character.isDigit(inValue.charAt(i)) == false)          {
          throw new xBaseJException("Invalid format for date Field, " + inValue + " non numeric at position " + i);
          }
    }


  int yea= Integer.parseInt(inValue.substring(0, 4));
  int mo = Integer.parseInt(inValue.substring(4, 6));
  if (mo < 1 || mo > 12)
          throw new xBaseJException("Invalid format for date Field (month) " + inValue ) ;
  int da = Integer.parseInt(inValue.substring(6, 8));
  if (da < 1)
          throw new xBaseJException("Invalid format for date Field (day) " + inValue);

  int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
  if ( yea == 2000 ||
       ( ( (yea % 4) == 0) && ( (yea % 100) != 0) )
     )
       month[2]++;
  if (da > month[mo])
          throw new xBaseJException("Invalid format for date Field, number of days > days in month");

  super.put(inValue);

}
View Full Code Here

   case Calendar.MONTH:
        return new String(buffer, 4, 2);
   case Calendar.DAY_OF_MONTH:
        return new String(buffer, 6, 2);
   default:
        throw new xBaseJException("Field type invalid");
  }
}
View Full Code Here

        buffer[2] = byter[2];
        buffer[3] = byter[3];
       break;
   case Calendar.MONTH:
        if (value < 1 || value > 12)
           throw new xBaseJException("Month value out of range");
        numFormat.setMinimumIntegerDigits(2);
        numFormat.setMaximumIntegerDigits(2);
        setter = numFormat.format(value);
        byter = setter.getBytes();
        buffer[4]= byter[0];
        buffer[5]= byter[1];
       break;
   case Calendar.DAY_OF_MONTH:
        if (value < 1 || value > 31)
           throw new xBaseJException("Day value out of range");
        numFormat.setMinimumIntegerDigits(2);
        numFormat.setMaximumIntegerDigits(2);
        setter = numFormat.format(value);
        byter = setter.getBytes();
        buffer[6]= byter[0];
        buffer[7]= byter[1];
       break;
   default:
        throw new xBaseJException("Field type invalid");
  }
}
View Full Code Here

* data not written into DBF until an update or write is issued.
* @param invalue value to set Field to.
*/
public void put(String invalue) throws xBaseJException
{
    throw new xBaseJException("use put(Bytes[])");
  }
View Full Code Here

          return;
         }
      }

   if (ret > 0)
       throw new xBaseJException("Duplicate key error");
}
View Full Code Here

  name = Name.substring(0,Name.lastIndexOf('.'))+".mdx";

  file = new File(name);

  if (!file.exists())
     throw new xBaseJException("Missing mdx file:" + name);

  if (readonly == 'r')
    nfile = new RandomAccessFile(file, "r");
  else
    nfile = new RandomAccessFile(file, "rw");
View Full Code Here

   {
     if ( tags[i].name.equalsIgnoreCase(Name) )
        return MDXes[i];
    }

  throw new xBaseJException("Unknown tag named " + Name);
}
View Full Code Here

   {
     if ( tags[i].name.equalsIgnoreCase(Name) )
        return tags[i];
    }

  throw new xBaseJException("Unknown tag named " + Name);
}
View Full Code Here

TOP

Related Classes of org.xBaseJ.micro.xBaseJException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.