Attaching a Reader to a Collection

i've got a Collection of Strings.
rather than iterate thru the Collection, i want to use a Reader+ to
get the data in the Collection.
how could i do that?

well, this is what i came up with.
turns out i did not want to use a Collection, but rather a raw String array.
public class RawArrayReader extends Reader {
    private char[] contents;
    private int position = 0;
    private int markPoint = 0;
    public RawArrayReader(String[] rawArray) {
        super();
        char[] tmp = new char[0];
        for(int i = 0; i < rawArray.length; i++) {
            String s = (String) rawArray;
char[] tmp2 = tmp;
tmp = new char[tmp.length + s.toCharArray().length + 1];
int j = 0;
while(j < (tmp.length - 1)) {
if(j < tmp2.length) {
tmp[j] = tmp2[j];
} else {
tmp[j] = s.toCharArray()[(j - tmp2.length)];
j++;
tmp[j] = " ".toCharArray()[0];
this.contents = new char[(tmp.length - 1)];
for(int i = 0; i < this.contents.length; i++) {
this.contents[i] = tmp[i];
public void close() { this.contents = null; }
public boolean markSupported() { return(true); }
public void reset() { position = markPoint; }
public boolean ready() {
if(contents == null) { return(false); }
return(true);
public void mark(int i) {
if (contents != null) {
if (i < 0) { i = 0; }
if (i < contents.length) {
markPoint = i;
} else {
markPoint = (contents.length - 1);
position = markPoint;
} else {
markPoint = 0;
position = 0;
public long skip(long n) throws IOException {
if((n + position) >= contents.length) {
throw(new IOException());
position += n;
return(n);
public int read() {
if(position >= contents.length) { return(-1); }
char c = contents[position];
position++;
return((int) c);
public int read(char[] buf) {
int x = 0;
while(x < buf.length) {
buf[x] = contents[position];
position++;
x++;
if (position >= contents.length) { return(-1); }
return(x);
public int read(char[] cbuf, int off, int len) {
int x = 0;
while(x < len) {
cbuf[off] = contents[position];
x++;
position++;
off++;
if (position >= contents.length) { return(-1); }
return(x);
}not tested this class completely. just finished it. this "seems" to work ok.
if this is a violation of how to OOP or use Java, please let me know.
help me learn this stuff.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • In the privacy policy, it states that percentages and durations of books read are being collected to ensure that publishers can have a metered price model, prices depending on how the book was read. Give me an example of a company with such a price model?

    In your privacy policy, you state that the percentages and durations of books read are being collected to ensure that publishers can choose a metered price model. Prices which depends on the duration for which the book was read.
    Give me an example of a company with such a price model? Are the information being collected even where the companies have not asked for the information, even when the metered price models are not being used?
    Here is an extract från the privacy policy:
    What information does Adobe Digital Editions collect and how is it used?
    The following information may be collected when an eBook with DRM is opened in Adobe Digital Editions software. If an eBook does not have any DRM associated with it, then no information is collected.
    User GUID: The User GUID is a unique value assigned in place of your User ID and is used to authenticate you.
    Device GUID: The Device GUID is a unique value generated to identify your device. It is used to ensure that the eBook may be viewed on your device and that the number of devices permitted by the license is not exceeded.
    Certified App ID: This ID represents the application that is being used to view the eBook, in this case Adobe Digital Editions. It is necessary to ensure that only a certified application may display an eBook. This helps to minimize piracy and theft of eBooks.
    Device IP (Internet Protocol): This identifies the country you are located in when you purchase an eBook.  It is used by eBook providers for the enablement of localized pricing models. Only the country identifier of the Device IP is stored.
    Duration for Which the Book was Read: This information may be collected to facilitate limited or metered pricing models entered into between eBook providers, such as publishers and distributors. These models are based on how long a reader has read an eBook. For example, you may borrow an eBook for a period of 30 days. While some publishers and distributors may charge libraries and resellers for 30 days from the date of the download, others may follow a metered pricing model and charge them for the actual time you read the eBook.
    Percentage of the eBook Read: The percentage of the eBook read may be collected to allow eBook providers such as publishers to implement subscription pricing models where they charge based on the percentage of the eBook read.
    Information provided by eBook providers relating to the eBook you have purchased: The following information is provided by the eBook provider to enable the delivery of the eBook to your device:Date of eBook purchase/download
    Distributor ID and Adobe Content Server Operator URL
    Metadata of the eBook, such as title, author, language, publisher list price, ISBN number
    How is the information transmitted?
    The data is sent periodically to Adobe via a secure transmission using HTTPS.
    How is the information used?
    Adobe uses the information collected about the eBook you have opened in Adobe Digital Editions software to ensure it is being viewed in accordance with the type of DRM license that accompanies that eBook. The type of license is determined by the eBook provider. For more information on how each piece of data is used, please see above.

    In your privacy policy, you state that the percentages and durations of books read are being collected to ensure that publishers can choose a metered price model. Prices which depends on the duration for which the book was read.
    Give me an example of a company with such a price model? Are the information being collected even where the companies have not asked for the information, even when the metered price models are not being used?
    Here is an extract från the privacy policy:
    What information does Adobe Digital Editions collect and how is it used?
    The following information may be collected when an eBook with DRM is opened in Adobe Digital Editions software. If an eBook does not have any DRM associated with it, then no information is collected.
    User GUID: The User GUID is a unique value assigned in place of your User ID and is used to authenticate you.
    Device GUID: The Device GUID is a unique value generated to identify your device. It is used to ensure that the eBook may be viewed on your device and that the number of devices permitted by the license is not exceeded.
    Certified App ID: This ID represents the application that is being used to view the eBook, in this case Adobe Digital Editions. It is necessary to ensure that only a certified application may display an eBook. This helps to minimize piracy and theft of eBooks.
    Device IP (Internet Protocol): This identifies the country you are located in when you purchase an eBook.  It is used by eBook providers for the enablement of localized pricing models. Only the country identifier of the Device IP is stored.
    Duration for Which the Book was Read: This information may be collected to facilitate limited or metered pricing models entered into between eBook providers, such as publishers and distributors. These models are based on how long a reader has read an eBook. For example, you may borrow an eBook for a period of 30 days. While some publishers and distributors may charge libraries and resellers for 30 days from the date of the download, others may follow a metered pricing model and charge them for the actual time you read the eBook.
    Percentage of the eBook Read: The percentage of the eBook read may be collected to allow eBook providers such as publishers to implement subscription pricing models where they charge based on the percentage of the eBook read.
    Information provided by eBook providers relating to the eBook you have purchased: The following information is provided by the eBook provider to enable the delivery of the eBook to your device:Date of eBook purchase/download
    Distributor ID and Adobe Content Server Operator URL
    Metadata of the eBook, such as title, author, language, publisher list price, ISBN number
    How is the information transmitted?
    The data is sent periodically to Adobe via a secure transmission using HTTPS.
    How is the information used?
    Adobe uses the information collected about the eBook you have opened in Adobe Digital Editions software to ensure it is being viewed in accordance with the type of DRM license that accompanies that eBook. The type of license is determined by the eBook provider. For more information on how each piece of data is used, please see above.

  • How can I Cache the data I'm reading from a collection of text files in a directory using a TreeMap?

    How can I Cache the data I'm reading from a collection of text files in a directory using a TreeMap? Currently my program reads the data from several text files in a directory and the saves that information in a text file called output.txt. I would like to cache this data in order to use it later. How can I do this using the TreeMap Class? These are the keys,values: TreeMap The data I'd like to Cache is (date from the file, time of the file, current time).
    import java.io.*;
    public class CacheData {
      public static void main(String[] args) throws IOException {
      String target_dir = "C:\\Files";
      String output = "C:\\Files\output.txt";
      File dir = new File(target_dir);
      File[] files = dir.listFiles();
      // open the Printwriter before your loop
      PrintWriter outputStream = new PrintWriter(output);
      for (File textfiles : files) {
      if (textfiles.isFile() && textfiles.getName().endsWith(".txt")) {
      BufferedReader inputStream = null;
      // close the outputstream after the loop
      outputStream.close();
      try {
      inputStream = new BufferedReader(new FileReader(textfiles));
      String line;
      while ((line = inputStream.readLine()) != null) {
      System.out.println(line);
      // Write Content
      outputStream.println(line);
      } finally {
      if (inputStream != null) {
      inputStream.close();

    How can I Cache the data I'm reading from a collection of text files in a directory using a TreeMap? Currently my program reads the data from several text files in a directory and the saves that information in a text file called output.txt. I would like to cache this data in order to use it later. How can I do this using the TreeMap Class?
    I don't understand your question.
    If you don't know how to use TreeMap why do you think a TreeMap is the correct solution for what you want to do?
    If you are just asking how to use TreeMap then there are PLENTY of tutorials on the internet and the Java API provides the methods that area available.
    TreeMap (Java Platform SE 7 )
    Are you sure you want a map and not a tree instead?
    https://docs.oracle.com/javase/tutorial/uiswing/components/tree.html

  • When I forward an email from my Mac Mail, the body of the email I just forwarded shows as an attachment in the recipients outlook.  Is there a way to change this so my clients don't have to open an attachment to read something that I forwarded to them?

    When I forward an email from my Mac Mail, the body of the email I just forwarded shows as an attachment in the recipients outlook.  Is there a way to change this so my clients don't have to open an attachment to read something that I forwarded to them?

    Open Terminal in Utilties and copy/paste
    This will send the attachment embedded inline. (This works in Snow Leopard, but not sure about Lion. Do a test first. If it doesn't work, just google "send attachment embedded + Lion." You don't actually have to send the message to see how it will appear.)
    defaults write com.apple.mail DisableInlineAttachmentViewing 0
    To reverse the setting, change the 0 to a 1
    However, whether this will work or not will depend on what the e-mail client on the receiver's end does with it.

  • AW attach in Read-only Mode in AWM

    Hi,
    How can I attach an AW in Read-only mode in AWM, so that multiple developers can open an AW but only one can modify it?
    Regards, Anirban

    See the documentation for the AW ATTACH command.
    >
    RW
    Specifies that the workspace is attached in read/write access mode. Only one user can have an analytic workspace open in read/write at a time. The user has to commit either all or none of the changes made to the workspace.
    An analytic workspace that is attached read/write non-exclusive can be accessed simultaneously by several sessions. The read/write non-exclusive attach mode is only compatible with the read-only access mode. A user can attach an analytic workspace in read/write mode when other users have the workspace attached in read-only mode; however, a user cannot attach an analytic workspace in read/write mode when another user has it attached in any other mode. Likewise, a user cannot attach an analytic workspace in any mode other than read-only when another user has it attached in read/write non-exclusive mode. When you attach an analytic workspace with read/write access, Oracle OLAP executes a program called PERMIT_WRITE, when it finds one in the workspace.
    RWX
    Specifies that the workspace is attached in read/write exclusive access mode. Only one user can have an analytic workspace open in read/write exclusive at a time. The user has to commit either all or none of the changes made to the workspace.
    An analytic workspace that is attached read/write exclusive cannot be accessed by any other sessions. The read/write exclusive attach mode is not compatible with any other access modes. A user cannot attach an analytic workspace in read/write exclusive mode when another user has it attached in any mode. Likewise, a user cannot attach an analytic workspace in any other mode when another user has it attached in read/write exclusive mode. When you attach an analytic workspace with read/write access, Oracle OLAP executes a program called PERMIT_WRITE, when it finds one in the workspace.

  • PO attachment error - Read error during PC upload

    Hi Gurus,
    I am getting the error when I am trying to attach any file in ME22N, by clicking the services for object button, create attachment, and select the attachment.
    The error message is "Read error during PC upload" and "The attachemnt has not been created".
    The system is upgraded to ECC 6 last year and have not tried this function before.
    Thanks in advance.
    Durai

    Hi,
    They are not using any interfaces (EDI), no idocs. They are using either fax or email and post modes only.
    After saving the PO, we can able to attach the documents by clicking the services for object button in ME22N. But I am not able to attach the document to PO.
    Thanks for your response.
    Regards
    Durai.

  • Outlook2013 email message goes behind main Outlook window when opening PDF attachment with Reader 11

    Problem statement: Outlook 2013 email message goes behind main Outlook window when opening PDF attachment with Adobe Reader 11.0.3
    Environment: Windows 8 x64; Office 2013; Adobe Reader 11.0.3
    Steps to reproduce bug:
    1. Open Outlook 2013
    2. Open email message with PDF attachment
    3. Open PDF attachment (with Adobe Reader as default PDF viewer)
    4. Close Adobe Reader
    Results: Original email message with PDF attacment now sits behind the main Outlook window
    Expected results: Original email message should be on top of main Outlook window as it was when opening the PDF attachment
    Note: Adobe Acrobat Profession performs as expected - the original email is on top of the main Outlook window - This only seems to be a problem with Adobe Reader.
    Has anyone else experience this problem?  If so, have you found a work-around?
    Thanks,
    Mike

    From: new window opens behind existing window - how to modify?
    I had this problem happening in Outlook.
    If I tried to open an email, it would open behind the main Outlook window.
    The same happened if I opened a link in the email - it would open behind the mail.
    The fix that was suggested to me was so simple that I still don't believe it.
    Right click on the task bar and unlock the taskbar, then lock it again.
    Close down Outlook and re-start it.
    Problem solved! Just dont know how  or why.
    Proposed as answer byalfreelandTuesday, January 08, 2013 4:52 PM
    It worked for me with Win 7 and OL 2003. Why? Who cares ... It is working.
    Liviu 2014-09-17

  • Sequential read of a collection

    Hello!
    I have defined a collection in this way...
    TYPE TABLA_SITUACION_TRIB_ACT IS TABLE OF VARCHAR2(2) INDEX BY VARCHAR2(10);
    g_SituacionesDeclaActual TABLA_SITUACION_TRIB_ACT;
    When I load that collection..
    How can I read this collection sequentially?
    Obviously the next "solution" doesnt works... :-)
    FOR i IN 1..g_tabla_situacion_trib.COUNT
    LOOP
    v_valor:=G_TABLA_SITUACION_TRIB(i).COD_DECE_SITR;
    END LOOP;

    SQL> declare
      2     TYPE TABLA_SITUACION_TRIB_ACT IS TABLE OF VARCHAR2(2) INDEX BY VARCHAR2(10);
      3     g_SituacionesDeclaActual TABLA_SITUACION_TRIB_ACT;
      4     idx varchar2(10);
      5  begin
      6     g_SituacionesDeclaActual ('a') := 'aa';
      7     g_SituacionesDeclaActual ('b') := 'bb';
      8     g_SituacionesDeclaActual ('c') := 'cc';
      9     idx := g_SituacionesDeclaActual.first;
    10     while idx is not null
    11     loop
    12        dbms_output.put_line ('Result: '||g_SituacionesDeclaActual(idx)); 
    13        idx := g_SituacionesDeclaActual.next(idx);
    14     end loop;
    15  end;
    16  /
    Result: aa
    Result: bb
    Result: cc
    PL/SQL procedure successfully completed.

  • Attaching Files: Reader Extensions Enabled

    I may not be understanding rightly, but have used a couple of sample files that have an 'add attachment' example (below is from example), and my form is distributed with reader extensions enabled, but this does not work in Adobe Reader.  What is the best method to give the person completing the form an avenue to upload and/or attach files?  If I have a web upload address for files, is there a way to add that to the form so they can stay in the form and still 'submit' it, but send their files to the web address?  Would prefer if they could attach in the PDF form to keep everything together but welcome any ideas that will work in Reader, thank you.
    var myDoc = event.target;
    var sFile = "myFile" + NumericField1.rawValue;
    myDoc.importDataObject({cName: sFile});
    var myDataObject = myDoc.getDataObject(sFile);
    var sFileName = myDataObject.path;
    ListBox1.addItem(sFileName,sFile);
    NumericField1.rawValue = NumericField1.rawValue + 1;

    Hi Sparrowce,
    I checked it at my end and i'm also getting the same issue. It seems that PDF rights enabled by Acrobat Reader extension would not provide necessary permission to the PDF to perform this task. However, i tried extending permissions via Livecycle Reader Extension server and it worked for me.
    Hence, i would say that for this issue you would require the LC Reader extension server as Acrobat as a desktop product would not be able to provide sufficient rights to the PDF for this concern.

  • Cant Attach Adobe Reader 8.1.2 PDf to Outlook

    I have installed the latest version with updates of adobe reader. When I try to attach certain PDF I get a Cant create file: (The file I want to attach and then says right click folder and check access writes.
    I have access As I can attach pdf, word and excel files in the same folder no problem
    Regards
    Duane

    Thanks for the link but my problem is with EXE files (amongst others) so, as stated in the MS article, you can't use that method to change the behaviour.
    By comparing to another machine, I have found is a set of keys in the HKCU registry that shouldn't be there -
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.exe]
    "Application"="AcroRD32.exe"
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.exe\OpenWi thList]
    "a"="AcroRd32.exe"
    "MRUList"="a"
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.exe\OpenWi thProgids]
    "exefile"=hex(0):
    Having now removed them using REGEDIT (& I remembered to back up my registry first!) I have now re-installed Acrobat Reader without experiencing problems (haven't rebooted yet, but I'm pretty sure it's fixed) - e.g. I can still use REGEDIT, launch IE7 or Firefox from icons that didn't work before.
    I have no idea how those keys got there, but they're gone now ;-}

  • How do i attache a read receipt to out ward emails

    How do i attach read receipt message to my emails

    Unless you know that the recipient's email software supports read receipts (which many don't) and is set to provide them (which many of the rest are not), the most effective way may be to type the text "Please let me know when you receive this message." as part of the message.

  • EMail attachment - Excel - Read only

    Hi Guys,
    I am send a email with an attachment using the F.M. - SO_NEW_DOCUMENT_ATT_SEND_API1,
    I am attaching a excel file also and everything works perfect but I wamt to make the attached excel file as READ-ONLY file Now it is modifiable, Please let me know is there any possible way to do it.
    Regards,
    Prabhu

    Hi Prabhu,
    As you want to make the file READ ONLY, i do not think it is possible with this function module. But there is another option which will make your file non transferable.
    Pass RECEIVERS-NO_FORWARD = 'X' in SO_NEW_DOCUMENT_ATT_SEND_API1 function module.
    Hope this will help you out.
    Regards,
    Sourabh

  • "read through" unmodifiable Collections

    I'm seeking clarification on the following clause extracted from the Collections.unmodifiableSet() JavaDoc (1.5): 'Query operations on the returned set "read through" to the specified set'.
    Does "read through" mean/imply that using the following definitions
    private Set d_rwSet = new HashSet();
    private Set d_roSet = Collections.unmodifiableSet(d_rwSet);Any subsequent change to d_rwSet will be automatically reflected in d_roSet?
    Thanks ... Matt

    Any subsequent change to d_rwSet will be
    automatically reflected in d_roSet?Yes that's correct.
    Kaj

  • How to get An Attachment from(reading outlook attachment from Java)

    I am developing a Java Email client. This Email client is working for "POP3" server. This is working fine for recieving all the emails other than Outlook express attachment. This is first time I am posting a topic even I had answered some topics. Now I am expecting your help for to solve this. Please help me if anybody faced the same problem.Please send me the Actuall code retreive Attachment from Inbox
    Please Send to me That code
    [email protected]

    I think this peice of information and code would help u
    Getting Attachments
    Getting attachments out of your messages is a little more involved then sending them, as MIME has no simple notion of attachments. The content of your message is a Multipart object when it has attachments. You then need to process each Part, to get the main content and the attachment(s). Parts marked with a disposition of Part.ATTACHMENT from part.getDisposition() are clearly attachments. However, attachments can also come across with no disposition (and a non-text MIME type) or a disposition of Part.INLINE. When the disposition is either Part.ATTACHMENT or Part.INLINE, you can save off the content for that message part. Just get the original filename with getFileName() and the input stream with getInputStream().
    Multipart mp = (Multipart)message.getContent();
    for (int i=0, n=multipart.getCount(); i<n; i++) {
    Part part = multipart.getBodyPart(i));
    String disposition = part.getDisposition();
    if ((disposition != null) &&
    ((disposition.equals(Part.ATTACHMENT) ||
    (disposition.equals(Part.INLINE))) {
    saveFile(part.getFileName(), part.getInputStream());
    The saveFile() method just creates a File from the filename, reads the bytes from the input stream, and writes them off to the file. In case the file already exists, a number is added to the end of the filename until one is found that doesn't exist.
    // from saveFile()
    File file = new File(filename);
    for (int i=0; file.exists(); i++) {
    file = new File(filename+i);
    The code above covers the simplest case where message parts are flagged appropriately. To cover all cases, handle when the disposition is null and get the MIME type of the part to handle accordingly.
    if (disposition == null) {
    // Check if plain
    MimeBodyPart mbp = (MimeBodyPart)part;
    if (mbp.isMimeType("text/plain")) {
    // Handle plain
    } else {
    // Special non-attachment cases here of
    // image/gif, text/html, ...
    regards
    shanu

  • ALL WIDOWS APPLICATIONS HAVE BEEN CONVERTED TO PDF FILES AFTER SENDING EMAIL ATTACHMENT IN READER 11

    Any help very appreciated.   I can clear the problem by uninstalling adobe reader 11.    But as soon as I re install the problem comes back all over again.
    Adobe technical will not help

    Here you go ---> Application, file icons change to Acrobat/Reader icon

Maybe you are looking for

  • How to create Development Class in SAP R/3 4.7c and Netweaver?

    I follow some old notes on ABAP Development Class but I could not create a new Development Class. i.e. Stuck in creatinf a type group.  Please give some details on how to create a development class.  Thanks. see the following stepa: (A) Procedure for

  • RMI security with client authentication

    Hy, I'm trying to set a secure RMI application using JSSE and SSL. I have succeeded in writing an application with client and server authentication using both an RMISSLServerSocketFactory and RMISSLClientSocketFactory and passing those factories to t

  • Apple TV wifi indicator light

    When did the green, wifi indicator (in lower left corner) get added? And how can you get rid of it?

  • IMove sound track won't go away!

    I created a soundtrack in garageband 11, imported it to iMove 11  then went back to lengthen it slightly.  iMovie will NOT recognize the revised soundtrack!  I have deleted the old one and reimported the new one to iTunes and then into iMove but the

  • Where can i download  JDeveloper 9.0.3.8 OA Extension version

    Hi, I googled in metalink but i didn't get any download link relates the OA extension version of Jdeveloper 9.0.3.8. Please tell me where can i download this. Thanks in Advance, SAN