Convert bytearray into sound
Hey..
I'm using blazeDs to comunicate with java classes, and i call a method that returns a sound file, that could either be wav or mp3,
i recieve it as a ByteArray, and i need to convert it and play, i tried Loader.loadBytes, but i get an error saying that it's an incompatible type.
Any help??
Thank you all so much..
Leandro
I don't know of any APIs to let you play sound from a bytearray. Someone might have cooked up a solution so search the internet.
One way you could do it is to add a SWF header to the byte array so it looks like a simple SWF with just a sound in it.
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui
Similar Messages
-
Converting bytearray into binary format
Hi I have a byteaary , I want to convert this byteArray data into binary format (01010101) , Please help me
[Bindable]
private var imgByte:ByteArray;
bitmapData = new BitmapData(pic.width, pic.height);
bitmapData.draw(pic,new Matrix());
var jpg:JPEGEncoder = new JPEGEncoder();
imgByte = jpg.encode(bitmapData) ;
var i:int=imgByte.readByte()
Alert.show(i.toString(2));
thanks in advanceDidn't toString(2) work?
-
Convert tline into pdf file document in Java
Dear ALL,
I built a RFC FM to convert smartform into tline which including PDF data.
the Code:
Converting to PDF Format
DATA l_lines TYPE TABLE OF tline WITH HEADER LINE.
* DATA l_lines1 TYPE TABLE OF solix_tab WITH HEADER LINE.
DATA l_docs TYPE TABLE OF docs.
DATA len TYPE i.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize = len
TABLES
otf = job_output_info-otfdata[]
doctab_archive = l_docs[]
lines = l_lines[] "this inner table include pdf file data
EXCEPTIONS
err_conv_not_possible? = 1
err_otf_mc_noendmarker = 2
OTHERS = 3.
*CALL METHOD cl_gui_frontend_services=>gui_download
* EXPORTING
* bin_filesize = len
* filename = 'c:\pdf.pdf'
* filetype = 'BIN'
* CHANGING
* data_tab = l_lines[]"i_objbin[]
* EXCEPTIONS
* OTHERS = 1.
"If i want to save it in my PC ,call this FM CALL METHOD cl_gui_frontend_services=>gui_download.
But i dont want to do it.I want to pass the parameter l_lines[] to java(web) by RFC, and convert to pdf file and show in java(web).
thanks
FreddyHi,
Update:
I have tested this and here is some code:
SAP:(I got the OTF from CALL FUNCTION 'PRINT_TEXT')
FORM get_pdf_data
USING
tdname TYPE thead-tdname
CHANGING
it_tline TYPE text_line_tab
bin_file TYPE xstring .
DATA: st_thead TYPE thead .
DATA: it_lines TYPE tline_tab .
st_thead-tdobject = 'TEXT' .
st_thead-tdname = tdname .
st_thead-tdid = 'ST' .
st_thead-tdspras = 'E' .
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = st_thead-tdid
language = st_thead-tdspras
name = st_thead-tdname
object = st_thead-tdobject
IMPORTING
header = st_thead
TABLES
lines = it_lines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc NE 0 .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 .
ENDIF.
DATA: it_otfdata TYPE otf_t_itcoo .
DATA: st_options TYPE itcpo.
st_options-tdgetotf = abap_true .
CALL FUNCTION 'PRINT_TEXT'
EXPORTING
dialog = abap_false
header = st_thead
OPTIONS = st_options
TABLES
lines = it_lines
otfdata = it_otfdata
EXCEPTIONS
canceled = 1
device = 2
form = 3
OPTIONS = 4
unclosed = 5
unknown = 6
format = 7
textformat = 8
communication = 9
bad_pageformat_for_print = 10
OTHERS = 11.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
DATA: it_otfdata_m TYPE otf_t_itcoo .
* "Merge pdf output demo"
APPEND LINES OF it_otfdata TO it_otfdata_m .
* DATA: bin_file TYPE xstring .
DATA: it_lines_dummy TYPE tline_tab .
DATA: bin_filesize TYPE i .
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_file = bin_file
bin_filesize = bin_filesize
TABLES
otf = it_otfdata_m
lines = it_lines_dummy
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5.
ENDFORM. " GET_PDF_DATA
Java:
final byte[] byteArray = function.getExportParameterList().getByteArray("BIN_FILE");
final Path path = Paths.get("My.pdf");
Files.write(path, byteArray, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE);
regards.
Another update:
Using in HttpServlet:
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.sap.conn.jco.JCoDestination;
import com.sap.conn.jco.JCoDestinationManager;
import com.sap.conn.jco.JCoException;
import com.sap.conn.jco.JCoFunction;
import com.sap.conn.jco.JCoRepository;
import com.sap.conn.jco.ext.Environment;
import destinations.MyDestination;
public class MyServlet extends HttpServlet {
@Override
protected void doGet(final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse) throws ServletException, IOException {
httpServletResponse.setContentType("application/pdf");
httpServletResponse.setStatus(HttpServletResponse.SC_OK);
final ServletOutputStream servletOutputStream = httpServletResponse.getOutputStream();
servletOutputStream.write(getPDF());
servletOutputStream.flush();
servletOutputStream.close();
private byte[] getPDF() {
try {
Environment.registerDestinationDataProvider(new MyDestination());
final JCoDestination destination = JCoDestinationManager.getDestination(destinations.Id.sapdev2.name());
final JCoRepository repository = destination.getRepository();
final JCoFunction function = repository.getFunction("Y_R_EITAN_TESTS_03");
function.execute(destination);
final byte[] byteArray = function.getExportParameterList().getByteArray("BIN_FILE");
return byteArray;
} catch (final JCoException exception) {
exception.printStackTrace();
return null; -
How to divide an bytearray into chunks in java using streams
how to divide an bytearray into chunks in java using streams
i'm trying to read an image using fileinputstream then converting to bytearray after conversion i have to read that image chunk by chunk and write to a outputstream
-
Need to convert values into coma separated
Need to convert values into coma separated
I have a string value that stores data like 'NYK,IND,SGP,GER'
FOR EXAMPLE
V_CITY_CODE = 'NYK,IND,SGP,GER'
When I query
select * from city where city_code = V_CITY_CODE;I get no rows, this is because V_CITY_CODE has all city code as single code.
I need a function to search , and replace with ','.
I tried using instr and replace but was unable to convert it.
could some one pls assist me.
thanks in advance
SazLooking for this?
SQL> select * from emp
2 /
EMPNO DEPTNO ENAME SAL DOJ JOB
1 1 Karthick 80 03-DEC-11
2 1 Karthick_1 90 23-NOV-11
3 2 Ram 80 03-DEC-11
4 2 Ram_1 90 23-NOV-11
SQL> var v_ename varchar2(1000)
SQL> exec :v_ename := 'Karthick,Karthick_1'
PL/SQL procedure successfully completed.
SQL> select *
2 from emp
3 where ename in (
4 select regexp_substr(val, '[^,]+', 1, level)
5 from (select :v_ename val from dual)
6 connect by level <= length(val) - length(replace(val, ','))+1
7 )
8 /
EMPNO DEPTNO ENAME SAL DOJ JOB
1 1 Karthick 80 03-DEC-11
2 1 Karthick_1 90 23-NOV-11 -
I worked in Adobe FireWorks to make the animated .gif. What program do I use to convert the file from .gif to any video format: .mp4, .m4v, .avi, .wmv, etc. I want to convert it into video format, so that QuickTime Player plays the video, I can insert it into iMovie '11 and edit, and also insert it into Final Cut Pro X and edit video.
Thanks for getting back with me so promptly. It has taken me this time to connect with the proper people to find out the information you requested.
The camera used to film the class was a Panasonic AG-HMC40P, owned by a local cable TV station; they use Kodak video encoding software, and a SD card was used to store the video. The file extension is .mts, and the mime file is MPEG 2 transport. He said I probably need an AVCHD converter, and the Mac app store lists 8 of those options, 4 free and 4 for up to $9.99. He said I'll also need a converter for later plans of posting on YouTube or on the website, and while some of those in the app store might work for the later needs, he knows one app called "Compressor" that would work for the uploading later. He also suggested I could try renaming the .mts file to .MP2T, but he wasn't sure that would work.
They don't work with Macs at the studio, but I had thought I could have some lessons there in editing, and apply what I learned to my iMac and iMovie.
First, though, I have to be able to see it and review it!
Thanks again! -
How to convert .class into .jar file
Hi,
How to convert .class into .jar filejsf_VWP5.5.1 wrote:
Hi,
How to convert .class into .jar fileFrom a command prompt, cd to the location of your .class file(s).
If you want to create a simple jar, use: jar -cf Whatever.jar Whatever.class
If you want to compile all .class files in a directory into a jar, use *.class instead.
Now, I'm going to assume you want to create an executable jar... here's how to do that:
1) Create a blank text file; for this example, lets call it main.txt.
2) In the first line of main.txt, type: Main-class: Whatever ('Whatever' should be the name of the class in your program where the main() method is located)
3) Press enter to go to the next line (someone please correct me if I'm wrong, but if you don't insert the line break/CR after the Main-class: statement, this will not work... in my experience, this is true)
4) Make sure you save this file in the same directory as your .class file(s).
5) Type: jar -cmf Whatever.jar main.txt Whatever.class
...and that's about it. For more information on the usage of the jar command and to understand the switches (such as -cmf), try jar --help.
Hope that helps. -
i work on release 11i application and converts some reports to run with xml publisher
i want to convert a total field that exist in po report to words it seems to convert number into words isthat possible i tried to make this in oracle reports and it run successfully but there is a problem when converting that report to run with xml publisher .
any help will be approtiated.Use ap_amount_utilities_pkg.ap_convert_number
E.g.
SQL> select ap_amount_utilities_pkg.ap_convert_number(trunc(12345678)) from dual;
AP_AMOUNT_UTILITIES_PKG.AP_CONVERT_NUMBER(TRUNC(12345678))
Twelve million three hundred forty-five thousand six hundred seventy-eight
Gareth -
I have 13 dollars left on an apple store gift card, how can I convert this into money for my iTunes account?
You can't.
-
While downloading an eBook from internet, I found a book in a folder containing around 123 files, which is equivalent to the number of pages of the book.
My interest is to bring them together in one file so that I can read it at a time. As the interface is not comfortable with html, I also like to convert it into another more suitable file format.Hello djensen1x,
Could you please let me know what version of Acrobat are you using.
Also, tell me your workflow of combining those PDF files?
Please share the screenshot of the error message that you get.
Hope to get your response.
Regards,
Anubha -
How to convert BLOB into a String
Hi,
I got a blob column from the database.
It contains one XML File.
How to convert it into String.
I need the code for how to convert the blob into String
Thanks in Advance.A blob would be a byte-array, which you can use in the String(byte[]) constructor
-
Can i open eps file in photoshop element 12 and convert it into jpeg?
can i open eps file in photoshop element 12 and convert it into jpeg?
You can open it in Irfanview (free), then save as JPEG.
Download the program here:
IrfanView - Official Homepage - one of the most popular viewers worldwide -
I Need help in converting a pdf into word. I've purchased it a few months ago and now for the first time I tried to use word and I can't it only gives me the option to convert it into a pdf when it is already a pdf! Urgent help please
Not sure what you mean by "tried to use Word". ExportPDF doesn't change what Word can do. Can you explain what you try and what happens in more detail?
-
How do I convert .pdf into searchable OCR using Adobe Acrobat Capture 3.0?
How do I convert .pdf into searchable OCR using Adobe Acrobat
Capture 3.0?
Our division is digitizing it's files, and we've been using
Adobe Acrobat 5.0 (2). We've 'scanned-in' several hundred
documents, but they have been saved as .pdf files (which are
currently not 'searchable', as they are only scanned images).
We just received the Adobe Acrobat Capture 3.0 program, and
we were told that we would be able to scan-in any new documents and
save them both as .pdf and OCR documents (Optical Character
Recognition). Therefore, we were told, we would be able to search
through the body of the document, using OCR, and not just through
the document filename, as we had been doing before.
HOWEVER, we don't know how to use this new OCRing program.
Also, we don't know how to convert the .pdf documents which we've
already scanned into OCR recognizable documents.
Is someone able to assist us here in this forum?
Merci beaucoup / Shokran jazilan / Thank you very much!
- Michael Kim Jamal Riegelman
United Nations Headquarters
Department of Peacekeeping Operations
Europe and Latin America Division
Office: (917) 367.9186
Email: [email protected]Hi Michael
Unfortunately I believe you have posted your issue in the
wrong forum. I believe you are looking for the forum linked below.
http://www.adobeforums.com/cgi-bin/webx/.ef7cbdf/
You might try re-posting your issue there.
Cheers and good luck! Rick -
Making spool, convert it into PDF and send that PDf throgh EMAIl
Hi,
In my making ALV report. In that i want to make the spool and then convert it into the pdf and send mail to the recepient.
AtulHi,
please try the following code. It works for me.
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
DATA : path LIKE pcfile-path.
DATA : extension(5) TYPE c.
DATA : name(100) TYPE c.
DATA:receiver TYPE somlreci1-receiver ,
p_file LIKE rlgrap-filename.
declarations for PDF convertion
DATA: path1 TYPE string ,
fullpath TYPE string.
DATA :textlines LIKE tline OCCURS 100 WITH HEADER LINE.
DATA otf LIKE itcoo OCCURS 1000 WITH HEADER LINE.
DATA it_lines LIKE tline OCCURS 100 WITH HEADER LINE.
DATA options LIKE itcpo.
DATA header LIKE thead.
DATA result LIKE itcpp.
DATA: bin_filesize TYPE i.
fullpath type string.
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
DATA: filesize TYPE i,
convcount TYPE i,
cancel(1).
textlines-tdformat = '*'.
textlines-tdline = 'Hello Hao'.
APPEND textlines.
options-tdgetotf = 'X'.
options-tdnoprev = 'X'.
CALL FUNCTION 'PRINT_TEXT'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX = ' '
ARCHIVE_PARAMS = ' '
DEVICE = 'PRINTER'
dialog = ' '
header = header
OPTIONS = options
IMPORTING
NEW_ARCHIVE_PARAMS =
RESULT = RESULT
tables
lines = textlines
otfdata = otf
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
UNKNOWN = 6
FORMAT = 7
TEXTFORMAT = 8
COMMUNICATION = 9
BAD_PAGEFORMAT_FOR_PRINT = 10
OTHERS = 11
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = filesize
TABLES
otf = otf
lines = it_lines
EXCEPTIONS
err_conv_not_possible = 1
err_bad_otf = 2.
fullpath = 'C:/foldername/test.pdf'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = bin_filesize
filename = fullpath
filetype = 'BIN'
APPEND = ' '
CODEPAGE = ' '
NO_BYTEORDER_MARK = ' '
IMPORTING
FILELENGTH = c
TABLES
data_tab = it_lines
FORMAT_TAB =
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6.
*filename = fullpath.
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
Set Variables
docdata-obj_name = 'Tst'.
docdata-obj_descr = 'Testing'.
reclist-receiver = give the mail id.
reclist-rec_type = 'U'.
APPEND reclist.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = fullpath
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
path = fullpath.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
CHECK_DOS_FORMAT =
IMPORTING
DRIVE =
extension = extension
name = name
NAME_WITH_EXT =
PATH =
EXCEPTIONS
invalid_drive = 1
invalid_extension = 2
invalid_name = 3
invalid_path = 4
OTHERS = 5
DATA : pos TYPE i.
DATA : len TYPE i.
Loop And Put Data
LOOP AT itab.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
objbin+len = itab(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND objbin.
CLEAR: objbin, len.
IF pos < 134.
objbin = itab+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND objbin.
ENDIF.
Packing Info For Text Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
Packing Info Attachment
name = extension.
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = name.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = name.
APPEND objpack.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8
IF sy-subrc <> 0.
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
Keerthi
Maybe you are looking for
-
Help (2d request) - iTunes renamed my iPod and won't update
I plugged my regular old iPod ("Kim's iPod") into iTunes on the same computer I always use, and got this message: The iPod "MyiPod" is linked to another iTunes music library. Do you want to change the link to this iTunes music library and replace all
-
HP Photosmart Prem Web C309n-s
I cannot get this printer to actually print in Adobe Photoshop Elements 8.0 . I choose the printer and then the HP Fax screen comes up. Adobe says it is not their issue it is an HP issue but HP has not been able to give me any suggestions. Any help
-
I want to know if someone can help me with this. The user is filling a form that contain also a date. how can I know if this day is valid ? for example 2/29/01 --- IS IT VALID ? Also if I want to add to this day 65 more days. is there any util functi
-
Bluetooth and wireless device not working
Hi. My bluetooth is not appearing in my pc settings and has disappeared from device manager after i updated windows 8.1 recently. Also my wifi is not working. In pc settings, then network and in the flight mode section it says "we couldn't find wirel
-
Connect BI 7.0 with ECC 5.0
Hello all, I don't seem to succeed when trying to connect my BI system with my ECC system. I have followed the best practices document "BI Connectivity" step by step, but I still get errors. When performing a connection test from BI - SM59 (one of th