cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

What changes i need to do if i change my snap binary input to document input

nikhilpurohit
New Contributor

Hi

i have a snap with binary input but now i want to change my binary input to document input what changes i need to do.

Below is my code snippet as document input.

@General(title = "xyz parser", purpose = "Smaple Snap", author = "Nikhil", docLink = "http://anyurl.com/")
@Outputs(min = 1, max = 1, offers = ViewType.DOCUMENT)
@Errors(min = 1, max = 1, offers = ViewType.DOCUMENT)
@Version(snap = 1)
@Category(snap = SnapCategory.PARSE)
public class XYZParser extends SimpleBinaryWriteSnap implements DependencyManager {

	@Inject
	private DocumentUtility documentUtility;

	@Inject
	private URLEncoder urlEncoder;

	@Inject
	private JfsUtils jfsUtils;

	@Override
	public Module getManagedModule() {
		return new AbstractModule() {
			@Override
			protected void configure() {
				bind(ForEx.class).to(ForExImpl.class);
				bind(JfsUtils.class).toInstance(JfsUtils.getInstance());
			}
		};
	}

	@Override
	public void defineProperties(PropertyBuilder propertyBuilder) {
			// configuration code here	
	}

	@Override
	public void configure(PropertyValues propertyValues) throws ConfigurationException {
			// configuration code here
	}

	@Override
	public void cleanup() throws ExecutionException {
		// TODO Auto-generated method stub

	}

	@Override
	protected void process(final Document document, final ReadableByteChannel readChannel) {
               // main process code here
		
               // writing output
		outputViews.write(documentUtility.newDocument(data),document);

	}

}

please give me code snippet as above when input is binary input.

Thanks
Nikhil Purohit

2 REPLIES 2

robin
Former Employee

Extend SimpleWriteSnap instead.

Thanks @robin