[brailleblaster] Re: Input and testing for document package

  • From: Keith Creasy <kcreasy@xxxxxxx>
  • To: "brailleblaster@xxxxxxxxxxxxx" <brailleblaster@xxxxxxxxxxxxx>
  • Date: Fri, 11 Jan 2013 15:41:04 +0000

Yes, my oversight I guess. Probably you'd want to construct an 
InputStreamReader. In any case, you can probably pass an InputStream into the 
startDocument method from whatever source and then construct the Reader like:


public startDocument (InputStream is) {
InputStreamReader reader = new InputStreamReader (is, charset);

//... continue processsing...
}

...


Keith Creasy
Software Developer
American Printing House for the Blind
KCreasy@xxxxxxx
Phone: 502.895.2405
Skype: keith537


-----Original Message-----
From: brailleblaster-bounce@xxxxxxxxxxxxx 
[mailto:brailleblaster-bounce@xxxxxxxxxxxxx] On Behalf Of Michael Whapples
Sent: Friday, January 11, 2013 5:23 AM
To: brailleblaster@xxxxxxxxxxxxx
Subject: [brailleblaster] Re: Input and testing for document package

In short you cannot find file path fron InputStream, it may be a stream of 
bytes from something other than a file.

If you wish to go more specific then FileInputStream has a method for finding 
the file descriptor, but then you are tied to files.

Also it is worth noting the javadocs say that FileInputStream is for reading 
bytes from a file, if you wish to read characters then use FileReader, see: 
http://docs.oracle.com/javase/7/docs/api/java/io/FileInputStream.html

Finally, InputStream is not an interface, it is an abstract class. There are 
differences between the two: Abstract classes may have implementation code 
where as interfaces are completely abstract, also classes may implement many 
interfaces but can only extend a single class (abstract or not). It is 
important to understand the differences and why one might use one over the 
other. BrailleBlaster probably could do with using a few interfaces.

Michael Whapples
On 11/01/2013 08:35, John J. Boyer wrote:
> First, as I suspected, There was a conflict between the name of the 
> Document class and the nu.xom.Document class. The compiler gave an 
> eror on the import statement for the latter. I have changed the name 
> of the Document class to DocumentBase .
>
> To test the document package, wome input is needed. BrailleBlaster can 
> directly open xml txt and brf files. These are passed through 
> liblouisutdml to have UTDML added. The augmented document then becomes 
> the working document. Could someone get DocumentManager working 
> sufficiently so that a file can be opened and passed to 
> DocumentBase.startDocument ?
>
> Keith has suggested that the input to startDocument should be 
> InputStream . However, Inp;utStream is an interface. liblouisutdml 
> requires a file path. How can the transition be made?
>
> Thanks,
> John
>



Other related posts: