private void repositoryInfo(OptionSet options) {
callRepoInfo(options.valueOf(fRepoId), options.valueOf(fCount));
}
private void createFiles(OptionSet options) {
ContentStream contentStream = null;
String fileNamePattern = options.valueOf(fFileNamePattern);
int count = options.valueOf(fCount);
int contentSize = options.valueOf(fContentSize);
System.out.println("Creating local files with content: ");
System.out.println("Kind: " + options.valueOf(fDocsPerFolder));
System.out.println("Number of files: " + count);
System.out.println("File name pattern: " + fileNamePattern);
System.out.println("Kind of content: " + options.valueOf(fContentKindStr));
System.out.println("Size of content (text only): " + contentSize);
ObjectGenerator objGen = new ObjectGenerator(null, null, null, null, null, fContentKind);
objGen.setContentSizeInKB(contentSize);
InputStream is = null;
FileOutputStream os = null;
try {
for (int i=0; i<count; i++) {
String fileName = String.format(fileNamePattern, i);
System.out.println("Generating file: " + fileName);
if (contentSize > 0) {
switch (fContentKind) {
case StaticText:
contentStream = objGen.createContentStaticText();
break;
case LoremIpsumText:
contentStream = objGen.createContentLoremIpsumText();
break;
case LoremIpsumHtml:
contentStream = objGen.createContentLoremIpsumHtml();
break;
case ImageFractalJpeg:
contentStream = objGen.createContentFractalimageJpeg();
break;
}
}
// write to a file:
is = contentStream.getStream();
os = new FileOutputStream (fileName);
byte[] b = new byte[64 * 1024];
int read;
while ((read = is.read(b)) != -1)
os.write(b, 0, read);