Search Results

Search found 3443 results on 138 pages for 'byte'.

Page 11/138 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Perl, treat string as binary byte array

    - by Mike
    In Perl, is it appropriate to use a string as a byte array containing 8-bit data? All the documentation I can find on this subject focuses on 7-bit strings. For instance, if I read some data from a binary file into $data my $data; open FILE, "<", $filepath; binmode FILE; read FILE $data 1024; and I want to get the first byte out, is substr($data,1,1) appropriate? (again, assuming it is 8-bit data) I come from a mostly C background, and I am used to passing a char pointer to a read() function. My problem might be that I don't understand what the underlying representation of a string is in Perl.

    Read the article

  • Lackadaisical One-to-One between Char and Byte Streams

    - by Vaibhav Bajpai
    I expected to have a one-to-one correspondence between the character streams and byte streams in terms of how the classes are organized in their hierarchy. FilterReader and FilterWriter (character streams) correspond back to FilterInputStream and FilterOutputStream (byte stream) classes. However I noticed few changes as - BufferedInputStream extends FilterInputStream, but BufferedReader does NOT extend FilterReader. BufferedOutputStream and PrintStream both extend FilterOutputStream, but BufferedWriter and PrintWriter does NOT extend FilterWriter. FilterInputStream and FilterOutputStream are not abstract classes, but FilterReader and FilterWriter are. I am not sure if I am being too paranoid to point out such differences, but was just curious to know if there was design reasoning behind such decision.

    Read the article

  • Convert byte array to understandable String

    - by Ender
    I have a program that handles byte arrays in Java, and now I would like to write this into a XML file. However, I am unsure as to how I can convert the following byte array into a sensible String to write to a file. Assuming that it was Unicode characters I attempted the following code: String temp = new String(encodedBytes, "UTF-8"); Only to have the debugger show that the encodedBytes contain "\ufffd\ufffd ^\ufffd\ufffd-m\ufffd\ufffd\/ufffd \ufffd\ufffdIA\ufffd\ufffd". The String should contain a hash in alphanumerical format. How would I turn the above String into a sensible String for output?

    Read the article

  • An image from byte to optimized web page presentation

    - by blgnklc
    I get the data of the stored image on database as byte[] array; then I convert it to System.Drawing.Image like the code shown below; public System.Drawing.Image CreateImage(byte[] bytes) { System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(bytes); System.Drawing.Image image = System.Drawing.Image.FromStream(memoryStream); return image; } (*) On the other hand I am planning to show a list of images on asp.net pages as the client scrolls downs the page. The more user gets down and down on the page he/she does see the more photos. So it means fast page loads and rich user experience. (you may see what I mean on www.mashable.com, just take care the new loads of the photos as you scroll down.) Moreover, the returned imgae object from the method above, how can i show it in a loop dynamically using the (*) conditions above. Regards bk

    Read the article

  • App Engine - Objectify - Storing a byte[]

    - by Spines
    I'm using the Objectify library for interfacing with the app engine datastore. In my User class, I store the hashed password as a byte[]. When I put it in the datastore, it is correctly stored as a blob. When I try to load the User object back out I get this error: java.lang.IllegalStateException: Cannot load non-collection value '<Blob: 40 bytes>' into private byte[] How do I fix this? Do I have to change my User class to have the hashed password be of type ShortBlob?

    Read the article

  • BlackBerry - Convert EncodedImage to byte []

    - by user324884
    I am using below code where i don't want to use JPEGEncodedImage.encode because it increases the size. So I need to directly convert from EncodedImage to byte array. FileConnection fc= (FileConnection)Connector.open(name); is=fc.openInputStream(); byte[] ReimgData = IOUtilities.streamToBytes(is); EncodedImage encode_image = EncodedImage.createEncodedImage(ReimgData, 0, (int)fc.fileSize()); encode_image = sizeImage(encode_image, (int)maxWidth,(int)maxHeight); JPEGEncodedImage encoder=JPEGEncodedImage.encode(encode_image.getBitmap(),50); ReimgData=encoder.getData(); is.read(ReimgData); HttpMultipartRequest( content[0], content[1], content[2], params, "image",txtfile.getText(), "image/jpeg", ReimgData );

    Read the article

  • wrong data type in mysql for grails byte[] property

    - by srkiNZ84
    Hi, I have an application which is trying to save a photo to the database. I've created a grails domain class with a byte[] property and this was working well when using HSQLDB (the default in grails). However, when I changed the database to MySQL I ended up getting the following error: Data truncation: Data too long for column 'photo' at row 1 I then had a look at the schema and found that the byte[] was being created as a TINYBLOB field, which was causing the error. How can I specify that this property should correspond to a BLOB/LONGBLOB type in the database?

    Read the article

  • What is/are the Scala way(s) to implement this Java "byte[] to Hex" class

    - by nicerobot
    I'm specifically interested in Scala (2.8) techniques for building strings with formats as well as interesting ways to make such a capability easily accessible where it's useful (lists of bytes, String, ...?).. public class Hex { public static String valueOf (final byte buf[]) { if (null == buf) { return null; } final StringBuilder sb = new StringBuilder(buf.length * 2); for (final byte b : buf) { sb.append(String.format("%02X", b & 0xff)); } return sb.toString(); } public static String valueOf (final Byteable o) { return valueOf(o.toByteArray()); } } This is only a learning exercise (so the utility and implementation of the Java isn't a concern.) Thanks

    Read the article

  • Bit/Byte adressing - Little/Big-endnian

    - by code8230
    Consider the 16-Bit data packet below, which is sent through the network in network byte order ie Big Endian: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 (Byte num) 34 67 89 45 90 AB FF 23 65 37 56 C6 56 B7 00 00 (Value) Lets say 8945 is a 16 bit value. All others are 8 bit data bytes. On my system, which is little endian, how would the data be received and stored? Lets say, we are configured to receive 8 bytes at a time. RxBuff is the Rx buffer where data will be received. Buff is the storage buffer where data would be stored. Please point out which case is correct for data storage after reading 8 bytes at a time: 1) Buff[] = {0x34, 0x67, 0x45, 0x89, 0x90, 0xAB....... 0x00}; 2) Buff[] = {0x00, 0x00, .......0x67, 0x89, 0x45, 0x34}; Would the whole 16 bytes data be reversed or only the 2 bytes value contained in this packet?

    Read the article

  • In SharePoint, why can I "multiple document upload" a 47,297 byte file, but not a 47,298 byte file?

    - by Jim
    It's strange. I can upload a document named 47k.txt that is 47,297 bytes using the "Multiple Document Upload" feature. However, if I add a single character to the end of the text file, the upload fails. Also, if I rename the file to 47k*x*.txt and try to upload it, it fails. This is the error I get in the SharePoint logs: Category: General Event ID: 8jzm Level: High Message: #90012: An error was encountered while processing files on the server. Try uploading one file at a time by using the single upload page. The same error is reported in a message box on the client side. Does anybody know why this would happen?

    Read the article

  • how to mod rewrite unicode byte sequence for the multibyte hyphen character

    - by ChickenFur
    We have case where some adobe pdf files format the hyphen character as %E2%80%90. See http://forums.adobe.com/message/2807241 this is caused by the Calibri font I guess. So these pdf files have been released and the links don't work So I thought mod rewrite would come to the rescue. I followed this post here mod_ReWrite to remove part of a URL but I can't seem to search for the % characters according to this question. Is there anything else I can do? Here is the rewrite rule I want to use: RewriteRule ^foo%(.+)bar /foo-bar [L,R=301] I also tried this and it doesn't work RewriteRule ^foo%E2%80%90bar /foo-bar [L,R=301] Any Ideas?

    Read the article

  • Is a ext3 Linux filesystem byte order independent

    - by Lothar
    I have a good old HP-C3700 Workstation with PA-RISC CPU here that I would like to use as a subversion server for a very large repository. I just worry what happens if the workstation dies (everybody who knows this computer knows that it is running like an Abrams tank and unlikely to happen in the next decade). I'm using Debian Linux on this system. If the mainboard dies can I just plug the SCSI drive into a PC and read the files from a normal Intel Linux PC? Which software RAID levels would be safe?

    Read the article

  • Why are hard drives moving to 4096 byte sectors, vs. 512 byte sectors?

    - by Chris W. Rea
    I've noticed that some Western Digital hard drives are now sporting 4K sectors, that is, the sectors are larger: 4096 bytes vs. the long-standing standard of 512 bytes. So: What's the big deal with 4K sectors? Is it marketing hype, or a real advantage? Why should somebody building a new PC care, or not, about 4K sectors? Why is this transition taking place now? Why didn't it happen sooner? Are there things to look out for when buying a 4K sector hard drive? e.g. incompatibility? Anything else we should know about 4K sectors?

    Read the article

  • 4K sectors transition: Why are hard drives moving to 4096 byte sectors, vs. 512 byte sectors?

    - by Chris W. Rea
    I've noticed that some Western Digital hard drives are now sporting 4K sectors, that is, the sectors are larger: 4096 bytes vs. the long-standing standard of 512 bytes. So: What's the big deal with 4K sectors? Is it marketing hype, or a real advantage? Why should somebody building a new PC care, or not, about 4K sectors? Why is this transition taking place now? Why didn't it happen sooner? Are there things to look out for when buying a 4K sector hard drive? e.g. incompatibility? Anything else we should know about 4K sectors?

    Read the article

  • Mac OS X will only upload zero-byte files through FTP

    - by tabacitu
    I'm using Mac OS X Lion and i've been having this problem with FTP (any FTP client, mind you. I tried Transmit, FileZilla, Cyberduck and the Terminal, all with the same result) I can browse files in my FTP Client, but when I upload files, the client hangs for a few seconds, then thinks it uploaded the files successfully, but it only creates a new file with one blank line in it. Sometimes, it manages to upload 4-5 lines. It then returns: 226 - Error during read from data connection 226 Transfer aborted But 2xx is a success message. It is not a server issue, since any Windows machine will upload just fine using the same network. Can anybody figure out what the problem is? It renders my mac useless for web development. The problem persists with SFTP and FTP with SSL/TLS. Later edit: Solved! Ok, turns out the problem goes away when I take out my router and connect directly through PPPoE. So the problem is with the router, I thought. But no, the problem is with the mac that connects through a router that connects through a PPPoE and tries to upload using FTP. Pretty specific, I know. The problem is with the MTU (maximum transmission unit). Apparently, mac os x breaks the file into chunks that are too large for the router to send, because the router's MTU was set lower than Mac OS X's. My router's was 1492, which is ok, but my Mac's MTU was 1500, which is unacceptable. I don't even understand why it works directly with PPPoE. Anyway, if you encounter the same problem, this is how you diagnose and fix it: In terminal, run: ifconfig | grep mtu to see what the MTU is for en0 (or en1, mine was en0) If it's 1500, run sudo ifconfig en0 mtu 1300 This should solve it. If so, it may only be until the next restart. You can also change the MTU in System Preferences \ Network \ Ethernet - Advanced \ Hardware

    Read the article

  • how can convert bitmap to byte array

    - by narasimha
    hi sir i am implementing image upload in sdcard image converting bitmap in bitmap convert in bytearray i am implementing this code import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.EOFException; import java.io.File; import java.io.FileDescriptor; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import android.R.array; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.util.Log; import android.widget.ImageView; public class Photo extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); File f = new File("/sdcard/DCIM/1.jpg"); FileInputStream is = null; try { is = new FileInputStream(f); Bitmap bm; bm = BitmapFactory.decodeStream(is,null,null); ByteArrayOutputStream baos = new ByteArrayOutputStream(1000); bm.compress(Bitmap.CompressFormat.JPEG,75, baos); System.out.println("3........................"+bm); ImageView pic=(ImageView)this.findViewById(R.id.picview); pic.setImageBitmap(bm); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } } }this code is i am implementing how can convert bitmap in byte array INFO/System.out(12658): 3........................android.graphics.Bitmap@4358e3d0 in debug this will be displayed how can retrieve bitmap to byte array

    Read the article

  • how to implement bitmap to byte array in android

    - by satyamurthy
    hi sir i am implementing image upload in sdcard image converting bitmap in bitmap convert in bytearray i am implementing this code import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.EOFException; import java.io.File; import java.io.FileDescriptor; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import android.R.array; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.util.Log; import android.widget.ImageView; public class Photo extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); File f = new File("/sdcard/DCIM/1.jpg"); FileInputStream is = null; try { is = new FileInputStream(f); Bitmap bm; bm = BitmapFactory.decodeStream(is,null,null); ByteArrayOutputStream baos = new ByteArrayOutputStream(1000); bm.compress(Bitmap.CompressFormat.JPEG,75, baos); System.out.println("3........................"+bm); ImageView pic=(ImageView)this.findViewById(R.id.picview); pic.setImageBitmap(bm); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } } }this code is i am implementing how can convert bitmap in byte array INFO/System.out(12658): 3........................android.graphics.Bitmap@4358e3d0 in debug this will be displayed how can retrieve bitmap to byte array

    Read the article

  • Slowdowns when reading from an urlconnection's inputstream (even with byte[] and buffers)

    - by user342677
    Ok so after spending two days trying to figure out the problem, and reading about dizillion articles, i finally decided to man up and ask to for some advice(my first time here). Now to the issue at hand - I am writing a program which will parse api data from a game, namely battle logs. There will be A LOT of entries in the database(20+ million) and so the parsing speed for each battle log page matters quite a bit. The pages to be parsed look like this: http://api.erepublik.com/v1/feeds/battle_logs/10000/0. (see source code if using chrome, it doesnt display the page right). It has 1000 hit entries, followed by a little battle info(lastpage will have <1000 obviously). On average, a page contains 175000 characters, UTF-8 encoding, xml format(v 1.0). Program will run locally on a good PC, memory is virtually unlimited(so that creating byte[250000] is quite ok). The format never changes, which is quite convenient. Now, I started off as usual: //global vars,class declaration skipped public WebObject(String url_string, int connection_timeout, int read_timeout, boolean redirects_allowed, String user_agent) throws java.net.MalformedURLException, java.io.IOException { // Open a URL connection java.net.URL url = new java.net.URL(url_string); java.net.URLConnection uconn = url.openConnection(); if (!(uconn instanceof java.net.HttpURLConnection)) { throw new java.lang.IllegalArgumentException("URL protocol must be HTTP"); } conn = (java.net.HttpURLConnection) uconn; conn.setConnectTimeout(connection_timeout); conn.setReadTimeout(read_timeout); conn.setInstanceFollowRedirects(redirects_allowed); conn.setRequestProperty("User-agent", user_agent); } public void executeConnection() throws IOException { try { is = conn.getInputStream(); //global var l = conn.getContentLength(); //global var } catch (Exception e) { //handling code skipped } } //getContentStream and getLength methods which just return'is' and 'l' are skipped Here is where the fun part began. I ran some profiling (using System.currentTimeMillis()) to find out what takes long ,and what doesnt. The call to this method takes only 200ms on avg public InputStream getWebPageAsStream(int battle_id, int page) throws Exception { String url = "http://api.erepublik.com/v1/feeds/battle_logs/" + battle_id + "/" + page; WebObject wobj = new WebObject(url, 10000, 10000, true, "Mozilla/5.0 " + "(Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)"); wobj.executeConnection(); l = wobj.getContentLength(); // global variable return wobj.getContentStream(); //returns 'is' stream } 200ms is quite expected from a network operation, and i am fine with it. BUT when i parse the inputStream in any way(read it into string/use java XML parser/read it into another ByteArrayStream) the process takes over 1000ms! for example, this code takes 1000ms IF i pass the stream i got('is') above from getContentStream() directly to this method: public static Document convertToXML(InputStream is) throws ParserConfigurationException, IOException, SAXException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(is); doc.getDocumentElement().normalize(); return doc; } this code too, takes around 920ms IF the initial InputStream 'is' is passed in(dont read into the code itself - it just extracts the data i need by directly counting the characters, which can be done thanks to the rigid api feed format): public static parsedBattlePage convertBattleToXMLWithoutDOM(InputStream is) throws IOException { // Point A BufferedReader br = new BufferedReader(new InputStreamReader(is)); LinkedList ll = new LinkedList(); String str = br.readLine(); while (str != null) { ll.add(str); str = br.readLine(); } if (((String) ll.get(1)).indexOf("error") != -1) { return new parsedBattlePage(null, null, true, -1); } //Point B Iterator it = ll.iterator(); it.next(); it.next(); it.next(); it.next(); String[][] hits_arr = new String[1000][4]; String t_str = (String) it.next(); String tmp = null; int j = 0; for (int i = 0; t_str.indexOf("time") != -1; i++) { hits_arr[i][0] = t_str.substring(12, t_str.length() - 11); tmp = (String) it.next(); hits_arr[i][1] = tmp.substring(14, tmp.length() - 9); tmp = (String) it.next(); hits_arr[i][2] = tmp.substring(15, tmp.length() - 10); tmp = (String) it.next(); hits_arr[i][3] = tmp.substring(18, tmp.length() - 13); it.next(); it.next(); t_str = (String) it.next(); j++; } String[] b_info_arr = new String[9]; int[] space_nums = {13, 10, 13, 11, 11, 12, 5, 10, 13}; for (int i = 0; i < space_nums.length; i++) { tmp = (String) it.next(); b_info_arr[i] = tmp.substring(space_nums[i] + 4, tmp.length() - space_nums[i] - 1); } //Point C return new parsedBattlePage(hits_arr, b_info_arr, false, j); } I have tried replacing the default BufferedReader with BufferedReader br = new BufferedReader(new InputStreamReader(is), 250000); This didnt change much. My second try was to replace the code between A and B with: Iterator it = IOUtils.lineIterator(is, "UTF-8"); Same result, except this time A-B was 0ms, and B-C was 1000ms, so then every call to it.next() must have been consuming some significant time.(IOUtils is from apache-commons-io library). And here is the culprit - the time taken to parse the stream to string, be it by an iterator or BufferedReader in ALL cases was about 1000ms, while the rest of the code took 0ms(e.g. irrelevant). This means that parsing the stream to LinkedList, or iterating over it, for some reason was eating up a lot of my system resources. question was - why? Is it just the way java is made...no...thats just stupid, so I did another experiment. In my main method I added after the getWebPageAsStream(): //Point A ba = new byte[l]; // 'l' comes from wobj.getContentLength above bytesRead = is.read(ba); //'is' is our URLConnection original InputStream offset = bytesRead; while (bytesRead != -1) { bytesRead = is.read(ba, offset - 1, l - offset); offset += bytesRead; } //Point B InputStream is2 = new ByteArrayInputStream(ba); //Now just working with 'is2' - the "copied" stream The InputStream-byte[] conversion took again 1000ms - this is the way many ppl suggested to read an InputStream, and stil it is slow. And guess what - the 2 parser methods above (convertToXML() and convertBattlePagetoXMLWithoutDOM(), when passed 'is2' instead of 'is' took, in all 4 cases, under 50ms to complete. I read a suggestion that the stream waits for connection to close before unblocking, so i tried using HttpComponentsClient 4.0 (http://hc.apache.org/httpcomponents-client/index.html) instead, but the initial InputStream took just as long to parse. e.g. this code: public InputStream getWebPageAsStream2(int battle_id, int page) throws Exception { String url = "http://api.erepublik.com/v1/feeds/battle_logs/" + battle_id + "/" + page; HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet(url); HttpParams p = new BasicHttpParams(); HttpConnectionParams.setSocketBufferSize(p, 250000); HttpConnectionParams.setStaleCheckingEnabled(p, false); HttpConnectionParams.setConnectionTimeout(p, 5000); httpget.setParams(p); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); l = (int) entity.getContentLength(); return entity.getContent(); } took even longer to process(50ms more for just the network) and the stream parsing times remained the same. Obviously it can be instantiated so as to not create HttpClient and properties every time(faster network time), but the stream issue wont be affected by that. So we come to the center problem - why does the initial URLConnection InputStream(or HttpClient InputStream) take so long to process, while any stream of same size and content created locally is orders of magnitude faster? I mean, the initial response is already somewhere in RAM, and I cant see any good reasong why it is processed so slowly compared to when a same stream is just created from a byte[]. Considering I have to parse million of entries and thousands of pages like that, a total processing time of almost 1.5s/page seems WAY WAY too long. Any ideas? P.S. Please ask in any more code is required - the only thing I do after parsing is make a PreparedStatement and put the entries into JavaDB in packs of 1000+, and the perfomance is ok ~ 200ms/1000entries, prb could be optimized with more cache but I didnt look into it much.

    Read the article

  • Boost class/struct serialization to byte array

    - by Dave18
    does boost library provide functions to pack the class/struct data into a byte array to shorten the length of serialized data? Currently i'm using stringstream to get the serialized data, for example - struct data { std::string s1; std::string s2; int i; }; template <typename Archive> void serialize(Archive &ar, data &d, const unsigned int version) { ar & d.s1; ar & d.s2; ar & d.i; } int main() { data d; d.s1 = "This is my first string"; d.s2 = "This is my second string"; d.i = 10000; std::stringstream archive_stream; boost::archive::text_oarchive archive(archive_stream); archive.operator <<(d); } How would i use a byte array instead of stringstream for data?

    Read the article

  • Converting from ANSI to Unicode

    - by Rayne
    Hi all, I'm using Visual Studio .NET 2003, and I'm trying to convert a program written in purely ANSI characters to be independent of Unicode/Multi-byte characters. The program has a callback function of pcap_loop, called "got_packet". It's defined as void got_packet(u_char *user, const struct pcap_pkthdr *header, const u_char *cpacket) { USES_CONVERSION; _TUCHAR *packet; packet = A2T(cpacket); ... } However, I get the error message error C2440: 'type cast': cannot convert from 'const u_char *' to 'ATL::CA2WEX<>' How do fix this? Thank you. Regards, Rayne

    Read the article

  • get length of data sent over network to TCPlistener/networkstream vb.net

    - by Jonathan.
    It seems the most obvious thing, but I just can't work out how to get the length of bytes sent over a network using a TCPClient and TCPListener? This is my code so far: 'Must listen on correct port- must be same as port client wants to connect on. Const portNumber As Integer = 9999 Dim tcpListener As New TcpListener(IPAddress.Parse("192.168.2.7"), portNumber) tcpListener.Start() Console.WriteLine("Waiting for connection...") 'Accept the pending client connection and return 'a TcpClient initialized for communication. Dim tcpClient As TcpClient = tcpListener.AcceptTcpClient() Console.WriteLine("Connection accepted.") ' Get the stream Dim networkStream As NetworkStream = tcpClient.GetStream() '' Read the stream into a byte array I need to get the length of the networkstream to set the size of the array of bytes I'm going to read the data into. But the networkStream.length is unsupported and does not work and throws an Notsupportedexception. The only other way I can think of is to send the size of the data before sending the data, but this seems the long way round.

    Read the article

  • Bluetooth txt file byte increases????

    - by cheesebunz
    Hi everyone, i am able to xfer files from 1 mobile device to another. When the sender sends this text file of 8 bytes, the receiver end will become a 256bytes txt file and when i open the contents of the txt file, there are my infos plus alot of square boxes. Here is my code from the sender: string fileName = @"SendTest.txt"; System.Uri uri = new Uri("obex://" + selectedAddr + "/" + System.IO.Path.GetFileName(fileName)); ObexWebRequest request = new ObexWebRequest(uri); Stream requestStream = request.GetRequestStream(); FileStream fs = File.OpenRead(fileName); byte[] buffer = new byte[1024]; int readBytes = 1; while (readBytes != 0) { readBytes = fs.Read(buffer,0, buffer.Length); requestStream.Write(buffer,0, readBytes); } requestStream.Close(); ObexWebResponse response = (ObexWebResponse)request.GetResponse(); MessageBox.Show(response.StatusCode.ToString()); response.Close(); Any1 knws how do i solve it?

    Read the article

  • View returned file from Webservice method

    - by gafda
    I already have a method in my webservice that returns a byte[] containing only the bytes of the file downloading. The invocation is something like: http://www.mysite.com/myWebservice.asmx with: string fileId = "123"; bytes[] fileContent = myWebservice.Download(fileId); What I wanted to do is be able to invoke this method or other (to be made) on a aspx webpage and be able to open a browser window containing the real content of the file. i.e. Most files are TXT and PDF. (Assuming the client has the PDF plugin that alows him\her to view PDF's on the browser.)

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >