How can I read a binary file?
In my AIR application, I'm trying to read a binary file and then post it via an HTTPService to a remote ColdFusion component that accepts a "binary" type argument. The result of the post is always:
The FILEOBJ argument passed to the addFile function is not of type binary.
Here is how I'm reading the file in Flex, where fileObj is of type File:
var fs : FileStream = new FileStream();
var bytes : ByteArray = new ByteArray();
fs.open(fileObj, FileMode.READ);
fs.readBytes(bytes, 0, fs.bytesAvailable);
fs.close();
I then pass "bytes" as the parameter to my HTTPService's send call, like so:
var params : Object = {method : "addFile", fileObject : bytes};
service.send(params);
When I debug, bytes contains the correct file size. Is it not in binary form? I've tried several other suggestions, but with the same result, so would appreciate any help.
Thanks!
One more step...
short are U16 integer
double are double precision float
bool seem to be 2 bytes (= U16)
char are string (variable length)
rgb are U16 integer, with high order byte = 0
rect should be 4 x U16 (top, left, bottom, right)
Chilly Charly (aka CC)
E-List Master - Kudos glutton - Press the yellow button on the left...
Similar Messages
-
I would like to read in and write physiological data files which were saved by BioPac�s AcqKnowledge 3.8.1 software, in conjunction with their MP150 acquisition system. To start with, I�d like to write a converter from different physiodata file format into the AcqKnowledge binary file format for version 3.5 � 3.7 (including 3.7.3). It will allow us to read different file format into an analysis package which can only read in file written by AcqKnowledge version 3.5 � 3.7 (including 3.7.3).
I attempted to write a reader following the Application Note AS156 entitled �AcqKnowledge File Format for PC with Windows� (see http://biopac.com/AppNotes/ app156Fi
leFormat/FileFormat.htm ). Note the link for the Mac File format is very instructive too - it is presented in a different style and might make sense to some people with C library like look (http://biopac.com/AppNotes/ app155macffmt/macff.htm).
I guess the problem I had was that I could not manage to read all the different byte data stream with File.vi. This is easy in C but I did not get very far in LabView 7.0. Also, I was a little unsure which LabView data types correspond to int, char , short, long, double, byte, RGB and Rect. And, since it is for PC I am also assuming the data to be written as �little endian� integer, and thus I also used byte swap vi.
Two samples *.acq binary files are attach to this post to the list. Demo.acq is for version 3.7-3.7.2, while SCR_EKGtest1b.acq was recorded and saved with AcqKnowledge 3.8.1, which version number is 41.
I would be grateful if you someone could explain how to handle such binary file stream with LabView and send an example to i
llustrate it.
Many thanks in advance for your help.
Donat-Pierre
Attachments:
Demo.acq 248 KB
SCR_EKG_test1b.acq 97 KBThe reading of double is also straight forward : just use a dble float wired to the type cast node, after inverting the string (indian conversion).
See the attached example.
The measure of skin thickness is based on OCT (optical coherent tomography = interferometry) : an optical fiber system send and received light emitted to/back from the skin at a few centimeter distance. A profile of skin structure is then computed from the optical signal.
CC
Chilly Charly (aka CC)
E-List Master - Kudos glutton - Press the yellow button on the left...
Attachments:
Read_AK_time_info.vi.zip 9 KB -
I would like to read in and write physiological data which was saved by Biopac�s AcqKnowledge 3.8.1 software, in conjunction with their MP150 acquisition system. To start with, I�d like to write a converter from different physiodata file format into the AcqKnowledge binary file format for version 3.5 � 3.7 (including 3.7.3). It will allow us to read different file format into an analysis package which can only read in file written by AcqKnowledge version 3.5 � 3.7 (including 3.7.3).
I attempted to write a reader following the Application Note AS156 entitled �AcqKnowledge File Format for PC with Windows� (see http://biopac.com/AppNotes/app156FileFormat/FileFormat.h
tm ). Note the link for the Mac File format is very instructive too - it is presented in a different style and might make sense to some people with C library like look (http://biopac.com/AppNotes/app155macffmt/macff.htm) .
I guess the problem I had was that I could not manage to read all the different byte data stream with File.vi. This is easy in C but I did not get very far in LabView 7.0. Also, because it is for PC I am assuming the data to be written as �little endian� integer, and thus I also used byte swap vi.
I would be grateful if you someone could explain how to handle such binary file stream with LabView and send an example to illustrate it.
Many thanks in advance for your help.
Donat-PierreOne more step...
short are U16 integer
double are double precision float
bool seem to be 2 bytes (= U16)
char are string (variable length)
rgb are U16 integer, with high order byte = 0
rect should be 4 x U16 (top, left, bottom, right)
Chilly Charly (aka CC)
E-List Master - Kudos glutton - Press the yellow button on the left... -
How can one read a Excel File and Upload into Table using Pl/SQL Code.
How can one read a Excel File and Upload into Table using Pl/SQL Code.
1. Excel File is on My PC.
2. And I want to write a Stored Procedure or Package to do that.
3. DataBase is on Other Server. Client-Server Environment.
4. I am Using Toad or PlSql developer tool.If you would like to create a package/procedure in order to solve this problem consider using the UTL_FILE in built package, here are a few steps to get you going:
1. Get your DBA to create directory object in oracle using the following command:
create directory TEST_DIR as ‘directory_path’;
Note: This directory is on the server.
2. Grant read,write on directory directory_object_name to username;
You can find out the directory_object_name value from dba_directories view if you are using the system user account.
3. Logon as the user as mentioned above.
Sample code read plain text file code, you can modify this code to suit your need (i.e. read a csv file)
function getData(p_filename in varchar2,
p_filepath in varchar2
) RETURN VARCHAR2 is
input_file utl_file.file_type;
--declare a buffer to read text data
input_buffer varchar2(4000);
begin
--using the UTL_FILE in built package
input_file := utl_file.fopen(p_filepath, p_filename, 'R');
utl_file.get_line(input_file, input_buffer);
--debug
--dbms_output.put_line(input_buffer);
utl_file.fclose(input_file);
--return data
return input_buffer;
end;
Hope this helps. -
How can I read the bootstrap files of any HDS Live stream and extract the fragment-URLs and fragment-numbers in plain text?
Could it be that it is some kind of compressed format in the bootstrap? Can I uncompress it wirh f4fpackager.exe? Could not find any download for f4fpackager.exe. I would prefere less code to do so. Is there something in Java of JavaScript, that can extract the fragment-numbers?
Thank you!Doesn't sound too hard to me. Your class User (the convention says to capitalize class names) will have an ArrayList or Vector in it to represent the queue, and a method to store a Packet object into the List. An array or ArrayList or Vector will hold the 10 user objects. You will find the right user object from packet.user_id and call the method.
Please try to write some code yourself. You won't learn anything from having someone else write it for you. Look at sample code using ArrayList and Vector, there's plenty out there. Post in the forum again if your code turns out not to behave. -
How can i read local excel file into internal table in webdynpro for abap a
Could someone tell me how How can i read local excel file into an internal table in webdynpro for abap application.
thank u for your replyDeep,
File manuplations...............................
1. At the presentation level:
->GUI_UPLOAD
->GUI_DOWNLOAD
->CL_GUI_FRONTEND
2. At the application server level:
->OPEN DATASET : open a file in the application server for reading or writing.
->READ DATASET : used to read from a file on the application server that has been opened for reading
-> TRANSFER DATASET : writing data to a file.
-> CLOSE DATASET : closes the file
-> DELETE DATASET : delete file
If file is on the local PC,use the function module GUI_UPLOAD to upload it into an internal table by passing the given parameters......
call function 'GUI_UPLOAD'
exporting
filename = p_file
filetype = 'ASC'
has_field_separator = '#'
tables
data_tab = t_data
p_file : excel file path.
t_data : internal table
<b>reward points if useful.</b>
regards,
Vinod Samuel. -
How can I read the EXCEL file while Program is running in background.
Hi all Expert,
How can I read the EXCEL file while Program is running in background.
Thanksyou need to place ur excel file on application server and follow this thread: Reading an Excel file from the application server?
loots of information if you can search forum.. thanks -
How can I read from a file line by line?
Hi!
Could someone post some code or explain how can I read from a file, and want I to read a line each time. How can I go to line number N?
Thankshi,
u can try this:
try {
// open text file
BufferedReader in = new BufferedReader(new FileReader(fileName));
String line=in.readLine();
while((line=in.readLine()) != null) {
System.out.println(line);
}The go to line number N i m not so sure.
Cheers
Jerry -
How can I read a Excel file?
How can I read an Excel file and compare if the cells type are numeric or not??
i hope you can can give me a hand..
thanksIf you want to use plsql try utl_file supplied package to read the excel file -> http://psoug.org/reference/utl_file.html
And you can use a function like this to understand if the column is number or not ;
CREATE OR REPLACE FUNCTION is_number (
char_in VARCHAR2)
RETURN BOOLEAN
IS
n NUMBER;
BEGIN
n := TO_NUMBER(char_in);
RETURN TRUE;
EXCEPTION
WHEN OTHERS THEN
RETURN FALSE;
END is_number;
DECLARE
x BOOLEAN;
BEGIN
IF is_number('ABC') THEN
dbms_output.put_line('TRUE');
ELSE
dbms_output.put_line('FALSE');
END IF;
END;
/ -
How can I read an excel file .xls from an forms 6i
Hi
I have forms6i and webutil don t work with this version, can I read an excel file from forms6i.
Thank uHi hosoriol,
You can refer an excel as an external table first using the steps below and then you can start reading from it.
If you want to update the excel file then create an view and create instead of triggers for it.
Steps
h3. 1.[Create an external table for the excel file |http://www.adp-gmbh.ch/ora/misc/ext_table.html|Click here to view detailed description]
h4. 1. Create a directory in Oracle where you have kept the xls file
create or replace directory ext_dir as '/home/rene/ext_dir';h4. 2. grant read, write on directory ext_dir to scott;
h4. 3. creating the external table
create table ext_table_csv (
i Number,
n Varchar2(20),
m Varchar2(20)
organization external (
type oracle_loader
default directory ext_dir
access parameters (
records delimited by newline
fields terminated by ','
missing field values are null
location ('file.csv')
reject limit unlimited;
Note_
If you want to update the excel file then create a view and then create the instead of triggers to do the update, delete or insert.[Creating views on external tables | http://www.dba-oracle.com/oracle_news/2005_9_1_updating_external_tables.htm]
h3. 2. Use the data block wizard and connect to the corresponding schema and create a database block.
Kindly click Correct or Helpful if it helps Thanks :-) -
How can I convert the binary file content to XML message
Dear friends,
I poll the binary file from a ftp server but the payload only includes the binary content, no XML structure in the payload, I hope to convert the binary content to a element node within the XML structure, how can I do that? via content conversion?
Thanks and regards,
BeanRead the binary file stream using java I/O standard functions and convert the read stream to Base64 format. Now map this content to one of the field in target XML structure.
You need a java mapping for this.
what is your target system?
Thanks,
Gujjeti.
Hi Gujjeti,
Thanks a lot for your kind help, my target system is R/3.
Can I achieve that with a UDF or a simple way?
Regards,
Bean -
How can I open different binary files from BLOB column ?
If we store some type of binary file (XLS, DOC, PDF, EML and so on, not only pictures) in BLOB column how can I show the different contents? We use designer and forms 9i with PL/SQL.
How can I copy the files from BLOB to file in a directory or how can I pass BLOB's content to the proper application directly to open it?The mime type is just a string as explained above (e.g. application/pdf...). There are lot of samples here and on metalink.
E.g. add a column mime_type varchar(30) to your blob table. Create a procedure similar to the following:
PROCEDURE getblob
(P_FILE IN VARCHAR2
IS
vblob blob;
vmime_type myblobs.mime_type%type;
length number;
begin
select document, mime_type into vblob,vmime_type from myblobs where docname = p_file;
length := dbms_lob.getlength(vblob);
if length = 0 or vblob is null then
htp.p('Document not available yet.');
else
owa_util.mime_header(vmime_type);
htp.p('Content-Length: ' || dbms_lob.getlength(vblob));
owa_util.http_header_close;
wpg_docload.download_file(vblob);
end if;
exception
when others then
htp.p(sqlerrm);
END;
Create a DAD on your application server (refer to documentation on how to create a DAD).
Display the blob from forms (e.g. on a when-button-pressed trigger):
web.show_document('http://myserver:port/DAD/getblob?p_file=myfilename','_blank');
For storing blobs in a directory on your db server take a look at the dbms_lob package.
For storing blobs in a directory on your app server take a look at WebUtil available on OTN.
HTH
Gerald Krieger -
How can i read only .txt file and skip other files in Mail Sender Adapter ?
Hi Friends ,
<b> I am working on scenario like , I have to read an mail attachement and send the data to R3.</b>
It is working fine if only the .txt file comes.
<b>Some times ,html files also coming along with that .txt files. That time my Mail adapter fails to read the .txt file.</b>
I am using PayLoadSwap Bean and MessageTransformBean to swap and send the attachment as payload .
<b>Michal as told to write the Adapter module to skip the files .But i am not ware of the adapter moduel . If any blogs is there for this kind of scenarios please give me the link.</b>
Otherwise , please tell me how to write adapter module for Mail Sender Adapter?
How to download the following
newest patch of XI ADAPTER FRAMEWORK CORE 3.0
from SAP Service Marketplace. Open the file with WinZip and extract the following
SDAs:
aii_af_lib.sda, aii_af_svc.sda
aii_af_cpa_svc.sda
I have searche in servive market place .But i couldn't find that . Can you please provide me the link to download the above .
If any other suggestions other than this please let me know.
Regards.,
V.Rangarajan=P
Dude, netiquette. Messages like "i need this now! Do it!" are really offensive and no one here is being payed to answer anyone's questions. We're here because we like to contribute to the community.
Anyway, in your case, just perform some search on how you could filter the files that are attached to the message. The sample module is just an example, you'll have to implement your own. Tips would be to query the filename of the attachments (or maybe content type) and for the ones which are not text, remove them.
Regards,
Henrique. -
How can i read the text files and buffer the data in Vector?
hi. I have been running into this problem for days, but with no luck and losing right direction.
The problem is : I am trying to read a text file and buffer the data into a
Queue for each user.
the sample text file is as below:( 1st column is timestamp, 2nd is user_id, 3rd is packet_id, 4th is packet_seqno, 5th is packet_size)
0 1 1 1 512
1 2 1 2 512
2 3 1 3 512
3 4 1 4 512
4 5 1 5 512
5 6 1 6 512
6 7 1 7 512
7 8 1 8 512
8 9 1 9 512
9 10 1 10 512
10 1 2 11 512
11 2 2 12 512
12 3 2 13 512
13 4 2 14 512
14 5 2 15 512
15 6 2 16 512
16 7 2 17 512
17 8 2 18 512
18 9 2 19 512
19 10 2 20 512
20 1 3 21 512
21 2 3 22 512
22 3 3 23 512
23 4 3 24 512
24 5 3 25 512
25 6 3 26 512
26 7 3 27 512
27 8 3 28 512
28 9 3 29 512
29 10 3 30 512
30 1 4 31 512
31 2 4 32 512
32 3 4 33 512
33 4 4 34 512
34 5 4 35 512
35 6 4 36 512
36 7 4 37 512
37 8 4 38 512
38 9 4 39 512
39 10 4 40 512
40 1 5 41 512
41 2 5 42 512
42 3 5 43 512
43 4 5 44 512
44 5 5 45 512
45 6 5 46 512
46 7 5 47 512
47 8 5 48 512
48 9 5 49 512
49 10 5 50 512
50 1 6 51 512
51 2 6 52 512
52 3 6 53 512
53 4 6 54 512
54 5 6 55 512
55 6 6 56 512
56 7 6 57 512
57 8 6 58 512
58 9 6 59 512
59 10 6 60 512
60 1 7 61 512
61 2 7 62 512
62 3 7 63 512
63 4 7 64 512
64 5 7 65 512
65 6 7 66 512
66 7 7 67 512
67 8 7 68 512
68 9 7 69 512
69 10 7 70 512
70 1 8 71 512
71 2 8 72 512
What I wanna do is to read all the data above and buffer them in a queue for each user( there are only 10 users in total).
I already created a class called Class packet:
public class packet {
private int timestamp;
private int user_id;
private int packet_id;
private int packet_seqno;
private int packet_size;
/** Creates a new instance of packet */
public packet(int timestamp,int user_id, int packet_id,int packet_seqno, int packet_size)
this.timestamp = timestamp;
this.user_id=user_id;
this.packet_id=packet_id;
this.packet_seqno=packet_seqno;
this.packet_size=packet_size;
}then I wanna to create another Class called Class user which I can create a queue for each user (10 users in total) to store type packet information. the queue for each user will be in the order by timestamp.
any idea and sample code will be appreciated.Doesn't sound too hard to me. Your class User (the convention says to capitalize class names) will have an ArrayList or Vector in it to represent the queue, and a method to store a Packet object into the List. An array or ArrayList or Vector will hold the 10 user objects. You will find the right user object from packet.user_id and call the method.
Please try to write some code yourself. You won't learn anything from having someone else write it for you. Look at sample code using ArrayList and Vector, there's plenty out there. Post in the forum again if your code turns out not to behave. -
How can I read several avi files in single DVD with FRONT ROW?
Hi!
Is it possible to make Front Row read several movie files in a single DVD?
I burned 6/7 avi files in each DVD, but Front Row can't even read the DVD itself!
Thanks!Hi Imcaet
It sounds as though you have made a Data DVD rather than a Movie DVD. Front Row can only read Movie DVDs. All Data must be in iTunes, or in on of the directories it looks in, such as "Movies" in your home directory.
If you need to combine the movies, you will need something like QuickTime Pro 7, which can be purchased from the Apple website. You need to Select All the movie you wish to Append, Copy, go to the End of the movie you wish to Append to, and Paste. You can then save/export the movie in full.
Maybe you are looking for
-
E-mail configuration in OBIEE 11g ( 11.1.1.5.0 )
Dear Gurus, I am trying to send emails through OBIEE 11.1.1.5.0 using oracle's internal email server stbeehive.oracle.com - port 465 email server This is failing with following error in Agent Log, AgentID: /users/weblogic/Agents/Agent1 [nQSError: 750
-
Hi Professionals! I have a column field as "Age group" in a matrix. I want to sort the order in Ascending. I have given my column field values below in the expression which I have used in the column group properties --> sort but its not working. Can
-
Reading message contexts from WCF custom behavior
Hi, I'm trying to create a WCF custom behavior extension because I can't simply use out of box WCF adapters without this customization. I'm trying to write some custom code in BeforeSendRequest() method in the message inspector, and I wonder from her
-
Is it possible to make gsm call on iPad 4
Is any one know how to make gsm cellular call through iPad 4 plz tell me
-
Hello, I am having problems reading an exception stack and help would be appreciated. Following is the exception I get: Apr 15, 2004 5:18:36 PM com.sun.faces.lifecycle.InvokeApplicationPhase execute SEVERE: #{OPCAdvancedQueryManagedBean.beanAction}: