Example usage for java.nio CharBuffer toString

List of usage examples for java.nio CharBuffer toString

Introduction

In this page you can find the example usage for java.nio CharBuffer toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representing the current remaining chars of this buffer.

Usage

From source file:com.arksoft.epamms.ZGlobal1_Operation.java

public int SendEmailForFilesWithCC(View ViewToWindow, View ResultSet, String stringSmtpServer,
        String stringRecipientEMailAddress, String stringSenderEMailAddress, String stringCC_EMailAddresses,
        String stringBCC_EMailAddresses, String stringEMailUserName, String stringEMailPassword,
        String stringSubjectLine, String stringBodyFileName, String stringAltTextFileName,
        String stringEmbeddedImages, String stringAttachmentFileName, int nMimeType, // 1-Text, 2-HTML
        int lConnection) {
    // String stringBodyMemoryStart;
    CharBuffer cbAtBodyFileName = CharBuffer.allocate(256);
    CharBuffer cbAtAltTextFileName = CharBuffer.allocate(256);
    // int  selBodyMemory;
    // int  lFileLth;
    zVIEW zqMDocOLST = null;//from w  w  w . j  av  a 2s . c o  m
    zVIEW wXferO = null;
    int nRC;

    // TraceLine( "SendEmailForFiles Server: %s   Sender: %s   Recipient: %s"
    //            "   Subject: %s   Mime Type: %d"
    //            "   User: %s   Password %s",
    //            stringSmtpServer, stringSenderEMailAddress, stringRecipientEMailAddress,
    //            stringSubjectLine, nMimeType, stringEMailUserName, stringEMailPassword );

    // First make sure the email address is valid. If not exit with return code of 2.
    if (IsEmailAddressValid(stringRecipientEMailAddress) == false)
        return 2;

    GetViewByName(zqMDocOLST, "zqMDocOLST", ResultSet, zLEVEL_TASK);
    GetViewByName(wXferO, "wXferO", ViewToWindow, zLEVEL_TASK);

    if (stringBodyFileName != null) {
        if (stringBodyFileName.isEmpty() == false && stringBodyFileName.charAt(0) != '@') {
            cbAtBodyFileName.put(0, '@');
            zstrcpy(cbAtBodyFileName, 1, stringBodyFileName);
        } else
            zstrcpy(cbAtBodyFileName, 0, stringBodyFileName);
    } else
        cbAtBodyFileName.put(0, '\0');

    if (stringAltTextFileName != null) {
        if (stringAltTextFileName.isEmpty() == false && stringAltTextFileName.charAt(0) != '@') {
            cbAtAltTextFileName.put(0, '@');
            zstrcpy(cbAtAltTextFileName, 1, stringAltTextFileName);
        } else
            zstrcpy(cbAtAltTextFileName, 0, stringAltTextFileName);
    } else
        cbAtAltTextFileName.put(0, '\0');

    // Read the data from the Body and Attachment files into memory and call
    // StartEmailClient with those values.

    // Read the Body into memory.
    // lFileLth = ReadFileDataIntoMemory( ResultSet, stringBodyFileName,
    //                                    &selBodyMemory, &stringBodyMemoryStart );

    // Exit if the file is empty or if there is an error opening it.
    // if ( lFileLth <= 0 )
    // {
    // The memory allocated to hold the body has been freed.
    //    IssueError( ResultSet, 0, 0, "Can't open Email file." );
    //    return -1;
    // }

    if (stringSubjectLine == null || stringSubjectLine.isEmpty())
        stringSubjectLine = " ";

    // TraceLine( "SendEmailForFiles2 Server: %s   Sender: %s   Recipient: %s"
    //            "   Subject: %s   Mime Type: %d"
    //            "   User: %s   Password %s",
    //            stringSmtpServer, stringSenderEMailAddress, stringRecipientEMailAddress,
    //            stringSubjectLine, nMimeType, stringEMailUserName, stringEMailPassword );

    // If there is an attachment file, also read it into memory.
    // Then call CreateSeeMessage with or without an attachment.
    if (stringAttachmentFileName != null && stringAttachmentFileName.isEmpty() == false) {
        nRC = m_ZDRVROPR.CreateSeeMessage(lConnection, stringSmtpServer, stringSenderEMailAddress,
                stringRecipientEMailAddress, stringCC_EMailAddresses, stringBCC_EMailAddresses,
                stringSubjectLine, nMimeType, cbAtBodyFileName.toString(), cbAtAltTextFileName.toString(),
                stringEmbeddedImages, 1, // has attachment
                stringAttachmentFileName, stringEMailUserName, stringEMailPassword);
    } else {
        nRC = m_ZDRVROPR.CreateSeeMessage(lConnection, stringSmtpServer, stringSenderEMailAddress,
                stringRecipientEMailAddress, stringCC_EMailAddresses, stringBCC_EMailAddresses,
                stringSubjectLine, nMimeType, cbAtBodyFileName.toString(), cbAtAltTextFileName.toString(),
                stringEmbeddedImages, 0, // no attachment
                "", // blank attachment file name
                stringEMailUserName, stringEMailPassword);
    }

    // SysFreeMemory( selBodyMemory );
    // DrFreeTaskMemory( stringBodyMemoryStart );

    return nRC;

}

From source file:com.arksoft.epamms.ZGlobal1_Operation.java

int WriteCSV_RecordFromEntity(View lLibPers, String entityName, int lFile) throws IOException {
    CharBuffer charBuffer = CharBuffer.allocate(32000);
    int nLth;/*from  ww w . j  a v  a  2 s.  c o  m*/

    charBuffer.put(0, '"');
    charBuffer.put(1, entityName.charAt(0)); // S E P (Student Employee Prospect)
    charBuffer.put(2, '"');
    charBuffer.put(3, ',');
    nLth = 4;

    nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, entityName, "Status", false);
    nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "Person", "CampusID", false);
    nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "Person", "ID", true);
    nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "Person", "LastName", false);
    nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "Person", "FirstName", false);
    nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "Person", "MiddleName", false);
    nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "Person", "Suffix", false);
    nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "Person", "PreferedFirstName", false);
    nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "Person", "Gender", false);
    nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "Person", "MaritalStatus", false);
    nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "Person", "HomePhone", false);
    nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "Person", "WorkPhone", false);
    nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "Person", "Extension", false);
    nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "Person", "eMailAddress", false);
    nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "Person", "DateOfBirth", false);
    if (CheckExistenceOfEntity(lLibPers, "Address") == 0) {
        nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "Address", "Line1", false);
        nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "Address", "City", false);
        nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "Address", "StateProvince", false);
        nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "Address", "PostalCode", false);
        nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "Address", "Country", false);
    } else {
        charBuffer.put(nLth++, ',');
        charBuffer.put(nLth++, ',');
        charBuffer.put(nLth++, ',');
        charBuffer.put(nLth++, ',');
        charBuffer.put(nLth++, ',');
    }

    nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, entityName, "ID", false);
    nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, entityName, "eMailAddress", false);
    if (entityName.charAt(0) == 'S') {
        nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, entityName, "CurrentLevel", false);
        nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, "AdministrativeDivision", "Name", false);
        nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, entityName, "ClearingHouseGradDate", false);
    } else if (entityName.charAt(0) == 'P') {
        nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, entityName, "ExpectedEntryTerm", false);
        nLth += AddAttributeToCSV(charBuffer, nLth, lLibPers, entityName, "ExpectedEntryYear", false);
    }

    if (nLth > 0 && charBuffer.get(nLth - 1) == ',')
        charBuffer.put(nLth - 1, '\0'); // drop terminating ',' and null terminate
    else
        charBuffer.put(nLth++, '\0'); // ensure null termination

    m_KZOEP1AA.SysWriteLine(lLibPers, lFile, charBuffer.toString());
    return nLth;
}

From source file:com.quinsoft.epamms.ZGlobal1_Operation.java

public int SendEmailForFiles(View ViewToWindow, View ResultSet, String stringSmtpServer,
        String stringRecipientEMailAddress, String stringSenderEMailAddress, String stringEMailUserName,
        String stringEMailPassword, String stringSubjectLine, String stringBodyFileName,
        String stringAltTextFileName, String stringEmbeddedImages, String stringAttachmentFileName,
        int nMimeType, // 1-Text, 2-HTML
        int lConnection) {
    // String stringBodyMemoryStart;
    CharBuffer cbAtBodyFileName = CharBuffer.allocate(256);
    CharBuffer cbAtAltTextFileName = CharBuffer.allocate(256);
    // int  selBodyMemory;
    // int  lFileLth;
    zVIEW zqMDocOLST = null;//w w  w  . ja  v  a2s  .co  m
    zVIEW wWebXfer = null;
    int nRC;

    // TraceLine( "SendEmailForFiles Server: %s   Sender: %s   Recipient: %s"
    //            "   Subject: %s   Mime Type: %d"
    //            "   User: %s   Password %s",
    //            stringSmtpServer, stringSenderEMailAddress, stringRecipientEMailAddress,
    //            stringSubjectLine, nMimeType, stringEMailUserName, stringEMailPassword );

    // First make sure the email address is valid. If not exit with return code of 2.
    if (IsEmailAddressValid(stringRecipientEMailAddress) == false)
        return 2;

    GetViewByName(zqMDocOLST, "zqMDocOLST", ResultSet, zLEVEL_TASK);
    GetViewByName(wWebXfer, "wWebXfer", ViewToWindow, zLEVEL_TASK);

    if (stringBodyFileName != null) {
        if (stringBodyFileName.isEmpty() == false && stringBodyFileName.charAt(0) != '@') {
            cbAtBodyFileName.put(0, '@');
            zstrcpy(cbAtBodyFileName, 1, stringBodyFileName);
        } else
            zstrcpy(cbAtBodyFileName, 0, stringBodyFileName);
    } else
        cbAtBodyFileName.put(0, '\0');

    if (stringAltTextFileName != null) {
        if (stringAltTextFileName.isEmpty() == false && stringAltTextFileName.charAt(0) != '@') {
            cbAtAltTextFileName.put(0, '@');
            zstrcpy(cbAtAltTextFileName, 1, stringAltTextFileName);
        } else
            zstrcpy(cbAtAltTextFileName, 0, stringAltTextFileName);
    } else
        cbAtAltTextFileName.put(0, '\0');

    // Read the data from the Body and Attachment files into memory and call
    // StartEmailClient with those values.

    // Read the Body into memory.
    // lFileLth = ReadFileDataIntoMemory( ResultSet, stringBodyFileName,
    //                                    &selBodyMemory, &stringBodyMemoryStart );

    // Exit if the file is empty or if there is an error opening it.
    // if ( lFileLth <= 0 )
    // {
    // The memory allocated to hold the body has been freed.
    //    IssueError( ResultSet, 0, 0, "Can't open Email file." );
    //    return -1;
    // }

    if (stringSubjectLine == null || stringSubjectLine.isEmpty())
        stringSubjectLine = " ";

    // TraceLine( "SendEmailForFiles2 Server: %s   Sender: %s   Recipient: %s"
    //            "   Subject: %s   Mime Type: %d"
    //            "   User: %s   Password %s",
    //            stringSmtpServer, stringSenderEMailAddress, stringRecipientEMailAddress,
    //            stringSubjectLine, nMimeType, stringEMailUserName, stringEMailPassword );

    // If there is an attachment file, also read it into memory.
    // Then call CreateSeeMessage with or without an attachment.
    if (stringAttachmentFileName.isEmpty() == false) {
        nRC = m_ZDRVROPR.CreateSeeMessage(lConnection, stringSmtpServer, stringSenderEMailAddress,
                stringRecipientEMailAddress, "", "", stringSubjectLine, nMimeType, cbAtBodyFileName.toString(),
                cbAtAltTextFileName.toString(), stringEmbeddedImages, 1, // has attachment
                stringAttachmentFileName, stringEMailUserName, stringEMailPassword);
    } else {
        nRC = m_ZDRVROPR.CreateSeeMessage(lConnection, stringSmtpServer, stringSenderEMailAddress,
                stringRecipientEMailAddress, "", "", stringSubjectLine, nMimeType, cbAtBodyFileName.toString(),
                cbAtAltTextFileName.toString(), stringEmbeddedImages, 0, // no attachment
                "", // blank attachment file name
                stringEMailUserName, stringEMailPassword);
    }

    // SysFreeMemory( selBodyMemory );
    // DrFreeTaskMemory( stringBodyMemoryStart );

    return nRC;

}

From source file:com.quinsoft.epamms.ZGlobal1_Operation.java

public int SendEmailForFilesWithCC(View ViewToWindow, View ResultSet, String stringSmtpServer,
        String stringRecipientEMailAddress, String stringSenderEMailAddress, String stringCC_EMailAddresses,
        String stringBCC_EMailAddresses, String stringEMailUserName, String stringEMailPassword,
        String stringSubjectLine, String stringBodyFileName, String stringAltTextFileName,
        String stringEmbeddedImages, String stringAttachmentFileName, int nMimeType, // 1-Text, 2-HTML
        int lConnection) {
    // String stringBodyMemoryStart;
    CharBuffer cbAtBodyFileName = CharBuffer.allocate(256);
    CharBuffer cbAtAltTextFileName = CharBuffer.allocate(256);
    // int  selBodyMemory;
    // int  lFileLth;
    zVIEW zqMDocOLST = null;/*  ww  w . ja  v a  2s  .c  o  m*/
    zVIEW wWebXfer = null;
    int nRC;

    // TraceLine( "SendEmailForFiles Server: %s   Sender: %s   Recipient: %s"
    //            "   Subject: %s   Mime Type: %d"
    //            "   User: %s   Password %s",
    //            stringSmtpServer, stringSenderEMailAddress, stringRecipientEMailAddress,
    //            stringSubjectLine, nMimeType, stringEMailUserName, stringEMailPassword );

    // First make sure the email address is valid. If not exit with return code of 2.
    if (IsEmailAddressValid(stringRecipientEMailAddress) == false)
        return 2;

    GetViewByName(zqMDocOLST, "zqMDocOLST", ResultSet, zLEVEL_TASK);
    GetViewByName(wWebXfer, "wWebXfer", ViewToWindow, zLEVEL_TASK);

    if (stringBodyFileName != null) {
        if (stringBodyFileName.isEmpty() == false && stringBodyFileName.charAt(0) != '@') {
            cbAtBodyFileName.put(0, '@');
            zstrcpy(cbAtBodyFileName, 1, stringBodyFileName);
        } else
            zstrcpy(cbAtBodyFileName, 0, stringBodyFileName);
    } else
        cbAtBodyFileName.put(0, '\0');

    if (stringAltTextFileName != null) {
        if (stringAltTextFileName.isEmpty() == false && stringAltTextFileName.charAt(0) != '@') {
            cbAtAltTextFileName.put(0, '@');
            zstrcpy(cbAtAltTextFileName, 1, stringAltTextFileName);
        } else
            zstrcpy(cbAtAltTextFileName, 0, stringAltTextFileName);
    } else
        cbAtAltTextFileName.put(0, '\0');

    // Read the data from the Body and Attachment files into memory and call
    // StartEmailClient with those values.

    // Read the Body into memory.
    // lFileLth = ReadFileDataIntoMemory( ResultSet, stringBodyFileName,
    //                                    &selBodyMemory, &stringBodyMemoryStart );

    // Exit if the file is empty or if there is an error opening it.
    // if ( lFileLth <= 0 )
    // {
    // The memory allocated to hold the body has been freed.
    //    IssueError( ResultSet, 0, 0, "Can't open Email file." );
    //    return -1;
    // }

    if (stringSubjectLine == null || stringSubjectLine.isEmpty())
        stringSubjectLine = " ";

    // TraceLine( "SendEmailForFiles2 Server: %s   Sender: %s   Recipient: %s"
    //            "   Subject: %s   Mime Type: %d"
    //            "   User: %s   Password %s",
    //            stringSmtpServer, stringSenderEMailAddress, stringRecipientEMailAddress,
    //            stringSubjectLine, nMimeType, stringEMailUserName, stringEMailPassword );

    // If there is an attachment file, also read it into memory.
    // Then call CreateSeeMessage with or without an attachment.
    if (stringAttachmentFileName != null && stringAttachmentFileName.isEmpty() == false) {
        nRC = m_ZDRVROPR.CreateSeeMessage(lConnection, stringSmtpServer, stringSenderEMailAddress,
                stringRecipientEMailAddress, stringCC_EMailAddresses, stringBCC_EMailAddresses,
                stringSubjectLine, nMimeType, cbAtBodyFileName.toString(), cbAtAltTextFileName.toString(),
                stringEmbeddedImages, 1, // has attachment
                stringAttachmentFileName, stringEMailUserName, stringEMailPassword);
    } else {
        nRC = m_ZDRVROPR.CreateSeeMessage(lConnection, stringSmtpServer, stringSenderEMailAddress,
                stringRecipientEMailAddress, stringCC_EMailAddresses, stringBCC_EMailAddresses,
                stringSubjectLine, nMimeType, cbAtBodyFileName.toString(), cbAtAltTextFileName.toString(),
                stringEmbeddedImages, 0, // no attachment
                "", // blank attachment file name
                stringEMailUserName, stringEMailPassword);
    }

    // SysFreeMemory( selBodyMemory );
    // DrFreeTaskMemory( stringBodyMemoryStart );

    return nRC;

}