Mapping of input Stream data onto a file at respective fields
Hi,
Can Anyone provide me info regarding how to Map (Using Java Mapping) a Huge amount of Incoming Arrays of Data from an IDOC onto a File in its Specified Fields?. If Possible provide me some examples.
Hi,
If I understood your question correctly then you want to store the incoming file (binary data) into MDM Binary Objects or some other table. This can be done easily using the Java API.
For example, if you want to save file XYZ.dat in MDM, then you need to read the file and create a byte array or InputStream. Now once you have the file in binary format, you can use BinaryBlobRecord to create a record of that type and assign the binary value that you have in the byte array. After this you need to use CreateRecordCommand to create the record by passing the BinaryBlob Object.
Hope this helps!!
Cheers,
Arafat
Similar Messages
-
How do I return an input stream from a text file
Suppose there's a class with methods..
one of the methods is something like..
public int value() and has a return statement at the end obviously for returning an int value..
Another method reads a text file and creates an input stream..
Scanner data = new Scanner(new File(input.next()));
I want to return the data when I do a call to this method, but I'm not sure what the method heading would look like..flounder wrote:
Are we supposed to magically know what those errors are? Do you think that copying and pasting the exact error messages and indicating the lines they occur on would be useful to us?Sorry about that..
I've replicated the same code below; and put the number of the line where the error is.
+cannot find symbol variable read [line 21]+
+cannot find symbol variable read [line 23]+
+cannot find symbol variable read [line 29]+
+cannot find symbol variable read [line 31]+
+cannot find symbol variable inputStream [line 44]+
+calculate() in textInput cannot be applied to (java.util.Scanner) [line 57]+
the reason I have the _______ for the createInputStream() method is because I'm not really sure what the heading type should be to return the input stream.
import java.io.*;
import java.util.*;
public class textInput
public void requestFileName()
Scanner input = new Scanner(System.in);
System.out.print("Enter file name: ");
public _______ createInputStream() throws FileNotFoundException
Scanner input = new Scanner(System.in);
Scanner read = new Scanner(new File(input.next()));
return read;
public void calculate() throws IOException
21 double max;
double min;
23 int count = 0;
double total = 0;
if (read.hasNextDouble())
double temp = read.nextDouble();
29 max = temp;
min = temp;
31 count++
total += temp;
while (read.hasNextDouble())
double current = read.nextDouble();
count++;
min = Math.min(current, min);
max = Math.max(current, max);
total += current;
System.out.println("Max of: " + max);
System.out.println("Min of: " + min);
44 System.out.println("Average of " + total/count);
public void close() throws IOException
inputStream.close();
public static void main(String[] args)
textInput run = new textInput();
try
57 run.requestFileName();
run.createInputStream();
run.calculate();
run.close();
catch(FileNotFoundException e)
System.out.println("File not found.");
System.exit(0);
catch(IOException e)
System.out.prinln("File not found.");
System.exit(0);
} -
Buffered Input stream - data corruption
Hi
I'm using the following code to transfer data to a file
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(
new StringBuffer(path).append(part.getFileName()).toString()));
BufferedInputStream in = new BufferedInputStream(part.getInputStream());
while (in.available() > 0) {
out.write(in.read());
out.close();
in.close();It write the image and text files properly
But all the application based data like zip files,.doc files are getting corrupted
How do I solve it? What is the problem with the code?
Help plsWhat a waste of buffers that code is.
We don't know how you might be corrupting the data
coming in because you haven't show us what that code
is like. All we see is part.getInputStream which is
hardly enough to make a diagnosis.OOps
private void writeAttachment(BodyPart part, String path) throws
MessagingException,
FileNotFoundException, IOException {
//Make new dir
new File(path).mkdirs();
if (this.EnsileCall)
this.log("Ensile writing <<" + part.getFileName() + ">> of size = " + part.getSize());
// Write to file
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(
new StringBuffer(path).append(part.getFileName()).toString()));
BufferedInputStream in = new BufferedInputStream(part.getInputStream());
while (in.available() > 0) {
out.write(in.read());
out.close();
in.close();
part.getInputStream() Part corresponds to a message body part in a mail(The attachment)
I'm getting the mail attachment's input stream and writing it to a file. -
Streaming data into a HDF5 file using mathscript
Hi Everybody,
I am developing a data logging system with a requirement to stream data into HDF5 files. I have previously written scripts in Matlab to stream the data using commands such as H5D.write etc. I do not seem to be able to access such low level commands in Mathscript. Is it possible to install any package to allow the use of these HDF5 commands in Mathscript?
Thanks,
PeterI also asked this question but there seems no definite solution...
Anyway, here are two possibilities
1) Share the directory holding the file among all nodes
2) Run you procedure on a specific node -
Buffered Input stream that increases internal buffer dynamically
I need to parse an input stream until I find a <META> tag with character encoding. I then need to reset to the beginning of the input stream and start parsing the stream again with the correct character encoding.
BufferedInputStream provides mark() and reset() methods which can be used to accomplish this task. However, the input stream data can be 1MB size and the only way I can think of forcing the BufferedInputStream to hold that content size is by specifying the size during construction.
I don't want to initialize the content size during construction of the BufferedStream for every data file I parse because some documents could have the tag in the beginning of the file and it could be waste of memory.
Question: Is there already a class which allows to set the maximum buffer size and which grows gradually to that size rather than during construction.
Thanks for any help.DrClap, I connect to a webserver and request a file. I just use the InputStream returned by the HttpResponse object to read the file. So, the answer to your question is I can't close and reopen the file.
Jawahar -
Create HelpSet using input stream and not URL
Hi All,
I looked over the docs and apis and I was not able to find any way to create a HelpSet from an input stream.
Basically all I have is are input streams to the help files and not URLs, is there a way to initialize the help set with that?
thanksNever compare Strings using Object equality or inequality ("==" resp. "!=").
Use [url http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#equals(java.lang.Object)]String#equals (or [url http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#indexOf(java.lang.String)]String#indexOf or [url http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#matches(java.lang.String)]String#matches).
Please use code tags when posting code. This means wrapping your text between [code[/b]][[/b]code] tags. See the [url http://forum.java.sun.com/help.jspa?sec=formatting]Formatting tips. -
Parse XML input stream (no .xml file)?
i have a java applet calling a web service that returns XML data as an input stream (char by char from SOAP) to this applet. if i append a all the chars to a string, is there some XML tool that will parse the string as if it were an XML document (like a getElement functions)?
the applet cannot write the data to a .xml file, and i don't want to mess around with .jarsigning. any ideas?
thanks,
jonathanThe XML parsers you are likely to be using support receiving input from a variety of sources besides files. For example you could parse XML from a String variable by passing a StringReader wrapping that String to the parser. Check the documentation for more details.
-
How to read a file as an input stream after it's posted in an HTML form ?
Hello,
I want to read client file after it's posted in an HTML form. But, I don't want to upload it to filesystem or database. I want to read posted file as an input stream. How can I do that ?
thanks in advance...A couple of things. If you have a FILE field in your form, the enctype of the form must be multipart/form-data. Check this link
http://www.htmlhelp.com/reference/html40/forms/form.html
Also, when a file is uploaded you cannot use the regular methods to get at the name/value pairs or the file itself. You'll have to use a utility like MultiPartRequest or write your own based on the RFC for Multipart requests.
http://www.servlets.com/cos/javadoc/com/oreilly/servlet/MultipartRequest.html
You will need some temporary file system to store this and then delete it when you are done with it.
hth -
Dear All
I hope my message finds you all well
My Question is : is it possible to log my data from cRIO to a network drive and stream the data being captured to a binary file in this drive ? and do the conventional File IO functions ?
I heard that DataSocket can do this , but it is mainly used between computers (this is what i understood so far about it)
My network drive is a DLink ShareCenter : http://sharecenter.dlink.com/products/DNS-320
I know that i can use the NI 9802 SD Card module , but it is out of my budget now to buy it
Please assist
Best Regards
Eng. Mohammed Ashraf
Certified LabVIEW Associated Developer
InnoVision Systems Founder, RF Test Development Engineer
www.ivsystems-eg.comHi Mohammed,
Are you trying to accomplish all this with or without the use of a host machine? If you're doing it with a host machine then the best bet would be to transfer data to the host using network published shared variables and then write to a file on the network from there.
If you're trying to do all this from the cRIO straight to the network drive with no intermediate host PC there are many things to consider. First off would be making sure there are no security protocols on the network drive that would prevent the cRIO from accessing it. Next you'd have to make sure there are no drivers required for the network drive as many drivers will not work on the Real-Time OS since most of these drivers are designed for a Windows system. If all this is taken care of then I'd say FTP is probably your best bet for getting files onto the network drive as long as you have an FTP server.
I'm unsure about if you would be able to stream to a binary file from a cRIO. I would need to know more about your application and what hardware you're using. Again I'd recommend you use a host PC and do the file I/O from there if possible. Can you tell us a bit more about your application and setup?
Miles G.
National Instruments
Applications Engineer -
Re: File Input Streams FileNotFoundException
Hi,
I'm having problems with file input streams.
The program is supposed to read from an external file but when I run it in Sun ONE Studio 4 (update 1), it gives me a FileNotFoundException (The system cannot find the file specified). The file, class.dat, is in the same folder as the .java and .class files.
Anyway, so I run the program through MS-Prompt commands and there is no problem. It executes fine and gives the right output. Go figure.
Can anyone shed some light on what is going on? Anyone else with the same problem? Is there something I need to configure in SunStudio? Please help...
Thanks
The code is taken directly from Sams Java in 21 days.
// code
import java.io.*;
public class ReadBytes {
public static void main(String[] arguments) {
try {
FileInputStream file = new
FileInputStream("class.dat");
boolean eof = false;
int count = 0;
while (!eof) {
int input = file.read();
System.out.print(input + " ");
if (input == -1)
eof = true;
else
count++;
file.close();
System.out.println("\nBytes read: " + count);
} catch (IOException e) {
System.out.println("Error -- " + e.toString());FileInputStream file = new FileInputStream("class.dat");Is this the line that is giving you the error message? Always, when trying to open a disk file, give the full path. This is because, FileNotFoundException is thrown only in cases when your file cannot be found by your program. But you say that the file exists.
Try giving your full path for the file...like:
FileInputStream file = new FileInputStream("C:/Program Files/class.dat");
//Ofcourse your path will be different. This is just an example!So try giving the full path and let me know.
Vijay :-) -
Hi All,
Am using OPENROWSET to load the file data into table, here the problem is i need to map same input value to two different columns of table, As format file doesn't allow the duplicate numbers am unable to insert same value to two columns, please help me to
find a solution for this.
i can use only OPENROWSET because i need to insert some default values also which come based on file. only the problem is how to map same input value to two different columns of table. please give me the suggestions.
Thanks,
SudhakarFrom what you say:
INSERT tbl(col1, col2)
SELECT col1, col1
FROM OPENROWSET(....)
But I guess it is more difficult. You need to give more details. What sort of data source do you have? What does your query look like? The target table?
Erland Sommarskog, SQL Server MVP, [email protected]
Hi Erland,
Thanks for your response
my source file is text file with | symbol separate for ex:
1002|eTab |V101|eTablet|V100|Logic|LT-7|Laptops|SCM
Database table have columns like
column1,column2,column3...etc, now i need to insert same value from input file into two columns for ex:
the eTab value from text file has to be insert into column2 and column3 of
table
we cannot change format file like below one
for the above situation how can we insert eTab into column2 and column3
Thanks,
Sudhakar. -
Streaming data and writing data to measurement file problem
Hi everyone,
I found something wrong about my code but i don't know exactly what it is first i have a program for acquiring 15 analog signals(NI PXI6259) after acquiring the data i use network stream to stream data from my NI PXI8186 to the host pc these steps are in target VI, after streaming data to host PC
, i tried to write down the data to the spreadsheet using Express write to measurement VI.
Problems : 1. After i run the host Vi and target Vi the number available to read is always 0 after sometimes the data displaying on the chart incdicator on host Vi is stopped and start counting the numberavailable to read also the time indicated on X axis of the chart doesn't grow.
2. Write to measurement file generate the file that record the data counting the data from 0 to 99 and start over and over again
Please help i really have no idea what is the cause for each problems.
Attachments:
target - single rate.vi 83 KB
Host UI.vi 36 KBDear Crossrulz
Thank you for your prompt reply i have removed the input to "Samples Per Channel" on the DAQmx Timing VI already but still didn't arrange the
channels input i will do it but i want to keep it this way first. Now the data acquiring looks okay but i have found new problem.
After running the program for acquiring the data for about 5 to 6 minutes the program will stop acquiring the data or
sometimes the target (NI pxi8186) will reboot itself and displaying message "Reboot due to system error" "System state: Safe Mode (System error)
and on the Host PC there will be a window pop-up displaying
"Waiting for the target (NI-PXI8186-2F0a597C) to respond" "Stop Waiting and Disconnect"
i didn't run the host Vi just run the target Vi only. If this problem caused from the program or the hardware ? Please help.
Attachments:
Host UI.vi 141 KB
target - single rate.vi 83 KB -
Data from a file need to be read and mapped into a custom table of R/3
Hello all,
This is related to inbound to SAP ECC via SAP PI.
There is a requirement concerning PI part that data from a file need to be read and mapped into a custom table of R/3.
To have this scenario developed , do we have any other option than the Proxy ?
My understanding is as follows : File --> SAP PI --> Proxy
You suggestions are welcome.
Regards,
RachanaHi Ravi,
As suggested by Inaki, you can use proxy communication in recever.
but you can also use the below
FILE -----> PI -------> PROXY
RFC
IDOC
to communicate to ECC system.
Regards
srinivas -
I recently synced some old photos onto my ipod touch and they briefly appeared on google maps in geographical/time date order. Couldnt bring it back up after Id logged out. id like to be able to do it again, any suggestions?
Have you tried the following document, kohida?
[What to do when Windows displays a blue screen error message or restarts when syncing the iPhone or iPod touch|http://support.apple.com/kb/TS1502] -
Hi, I have just loaded Lightroom 5 from the disc onto my Mac. every time i try and launch the application, it goes to the registration/licence window. i have input the data five times already. When Lr5 launches the update window appears, when i try to do anything the following message comes up: - An error occrred when attempting to change modules. What do i need to do to fix this?
Masher please use the uninstaller located in the Applications/Utilities/Adobe Installers folder. Once Photoshop Lightroom is removed then please download Lightroom 5.5 from Adobe - Lightroom : For Macintosh : Adobe Photoshop Lightroom 5.5 and reinstall.
Maybe you are looking for
-
Issue with Sender AXIS Adapter while XML Signing
Hi all, We are working on a scenario, an external application pushes message to Sender AXIS Adapter in PI. However while testing XML signing we are getting below error: <faultcode>soapenv:Server.generalException</faultcode> <faultstring>WSDoAllRece
-
Adobe Captivate 7 Installing Problem
I purchased the Adobe Captivate 7 software on Feb 4 through Adobe website. As there were some issues on my computer yesterday, I uninstalled Captivate 7. But today, when I tried to download the software again and reinstall it, it did not work. After
-
don't know how I even got osx..I was on apple..now on icloud..don't want iclould cause my mail it Not going on AOL..messages(icloud messages only) are not delivered and in green not blue...address book messed up to...please help to get my phone bac
-
HT204089 facing issuess with wifi sync on my pc. it is nt connecting to my iphone 6
wifi sync is not working on my itunes with my iphone 6
-
Recurring Documents run schdule configuration
Dear all, I have a question regarding the recurring document run schdule configuration. my example is below I received an insurance policy, Period :23.02.2011 - 23.05.2011 (for 3 months) amount: 15.000 USD First I posted this policy to vendor account