[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

sample[jx8-android] fileContents


SwikiCodeRobot @> #JX8AndroidFileContents

"#fileContents for reading files"
| pathName text |
pathName := '*/A8/u8.configuration.json'.
text := pathName fileContents.
self
  print: 'Contents at ',pathName;
  print: 'size=',text size.
^text


"#fileContents for reading invalid file"
| pathName text |
pathName := '*/missing S8 folder/missing.image.js'.
text := pathName fileContents.
text isNil ifFalse: [
	^self error: 'Should be nil'
].
^text


"#fileContents for reading URL"
| pathName text |
pathName := 'http://www.smalltalking.net'.
text := pathName fileContents.
self
  print: 'Contents at ',pathName;
  print: 'size=',text size.
^text


"#fileContents for reading U8 files"
| pathName text |
pathName := 'u8:aleReimondo/platforms.json'.
text := pathName fileContents.
self
  print: 'Contents at ',pathName;
  print: 'size=',text size.
^text


"#fileContents for reading Swiki pages"
| pathName text |
pathName := 'swiki:s8-media/.pages'.
text := pathName fileContents.
self
  print: 'Contents at ',pathName;
  print: 'size=',text size.
^text


"#fileContents for reading invalid URL"
| pathName text |
pathName := 'http://invalidURL/to/file.st'.
text := pathName fileContents.
text isNil ifFalse: [
	^self error: 'Should be nil'
].
^text