The way to do this is to use the IDfSysObject.setContent()
method. It is going to be more code, because you can't use the Import operation conveniences, but it should allow you to save a stream. Maybe something like this (but you would already have the stream from somewhere):
File pdfInput = new File("C:\\Rupinder\\MyFile.txt");
byte[] outBytes = new byte[(int)pdfInput.length()];
FileInputStream fileInputStream = new FileInputStream(pdfInput);
fileInputStream.read(outBytes);
ByteArrayOutputStream out = new ByteArrayOutputStream();
out.write(outBytes);
IDfSysObject sysObj = (IDfSysObject)session.newObject("c_pdf");
sysObj.setObjectName("testDoc");
sysObj.setContentType("crtext");
sysObj.setTitle("import operation");
sysObj.link("/Temp/Source Folder");
sysObj.setContent(out);
sysObj.save();