Package com.ibm.as400.access

Examples of com.ibm.as400.access.CharConverter


      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();
View Full Code Here


   * @param callData - String to be written
   * @exception XException if any error occurs
   */
  public String execute(String function, String callData) throws XException
  {
    RecordFormat format = prepareWriting();

    if (callData == null)
      callData = "";

    writeData(callData, mOriginFile, format);
View Full Code Here

        // Retreive and set an record format of the file.
        AS400FileRecordDescription recordDescription = new AS400FileRecordDescription(
            mAS400System, mQSYSobjPathname.getPath());
        RecordFormat[] formatArr = recordDescription
            .retrieveRecordFormat();
        RecordFormat format = formatArr[0];

        mOriginFile.setRecordFormat(format);

        if (mResolution.equals(Constants.WRITE_OVERWRITE))
        {
View Full Code Here

   * @param callData - String to be written
   * @exception XException if any error occurs
   */
  public Object execute(String function, Object callData) throws XException
  {
    RecordFormat format = prepareWriting();

    if (callData == null)
      callData = new ByteArrayList();

    writeData(callData, mOriginFile, format);
View Full Code Here

      // Write file ONLY if file exist because the format of the file is
      // needed!
      if (new IFSFile(mAS400System, mQSYSobjPathname.getPath()).exists())
      {
        // initiate the SequentialFile object
        mOriginFile = new SequentialFile(mAS400System, mQSYSobjPathname
            .getPath());

        // Retreive and set an record format of the file.
        AS400FileRecordDescription recordDescription = new AS400FileRecordDescription(
            mAS400System, mQSYSobjPathname.getPath());
View Full Code Here

  protected void setLock(AS400 as400System, String lockFilename)
      throws XException
  {
    try
    {
      SequentialFile seqFile = new SequentialFile(as400System,
          lockFilename);
      seqFile.lock(SequentialFile.WRITE_EXCLUSIVE_LOCK);
    } // try
    catch (Exception ex)
    {
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_TECHNICAL,
View Full Code Here

   * @exception XException if the file lock can not be released
   */
  protected void releaseLock(AS400 as400System, String lockFilename)
      throws XException
  {
    SequentialFile lockFile = new SequentialFile(as400System, lockFilename);
    if (lockFile.getExplicitLocks().length > 0)
    { // There are locks.
      try
      {
        lockFile.releaseExplicitLocks();
      } // try
      catch (Exception ex)
      {
        List params = new Vector();
        params.add(lockFilename);
View Full Code Here

   * @throws XException if the file cannot be deleted for any reason
   */
  protected void deleteFile(AS400 mAS400System, String fileName)
      throws XException
  {
    SequentialFile file = new SequentialFile(mAS400System, fileName);
    try
    {
      file.delete();
    } // try
    catch (Exception ex)
    {
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_TECHNICAL,
View Full Code Here

   * @throws XException if the member cannot be deleted for any reason
   */
  protected void deleteMember(AS400 as400System, String fileName)
      throws XException
  {
    SequentialFile srcFile = new SequentialFile(as400System, fileName);
    try
    {
      srcFile.deleteMember();
    } // try
    catch (Exception ex)
    {
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_TECHNICAL,
View Full Code Here

      {
        Trace.info("Receiving data from "
            + xbusSystem.replaceAllMarkers(mConfigFilename)[0]);

        // initiate the SequentialFile object
        mOriginFile = new SequentialFile(mAS400System, mQSYSObject
            .getPath());

        // lock original file with the WRITE_EXCLUSIVE_LOCK lock type
        mOriginFile.lock(SequentialFile.WRITE_EXCLUSIVE_LOCK);
View Full Code Here

TOP

Related Classes of com.ibm.as400.access.CharConverter

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.