Android :: Buffered Input Stream Buffer Size

Jul 5, 2010

I use BufferedInputStream in my code: socket = new Socket(ip, Integer.parseInt(port)); socket.setReceiveBufferSize(64000); output = socket.getOutputStream(); input = new BufferedInputStream(socket.getInputStream(), 64000); I read incoming packets like this: if (input.available() != 0) { System.out.println("Get Packet: " + input.available() + " bytes"); byte[] b = new byte[input.available()]; input.read(b); incParser(b); }

Android :: Buffered Input stream buffer size


Android :: Change Internal Buffer Size Of Data Input Stream

Apr 1, 2010

I'm using this kind of code for my TCP/IP connection:

sock = new Socket(host, port);
sock.setKeepAlive(true);
din = new DataInputStream(sock.getInputStream());
dout = new DataOutputStream(sock.getOutputStream());

Then, in separate thread I'm checking din.available() bytes to see if there are some incoming packets to read. The problem is, that if a packet bigger than 2048 bytes arrives, the din.available() returns 2048 anyway. Just like there was a 2048 internal buffer. I can't read those 2048 bytes when I know it's not the full packet my application is waiting for. If I don't read it however - it'll all stuck at 2048 bytes and never receive more. Can I enlarge the buffer size of DataInputStream somehow? Socket receive buffer is 16384 as returned by sock.getReceiveBufferSize() so it's not the socket limiting me to 2048 bytes. If there is no way to increase the DataInputStream buffer size - I guess the only way is to declare my own buffer and read everything from DataInputStream to that buffer?

View 4 Replies View Related

Android :: Getting File Size Before Input Stream

Aug 12, 2010

I want to create a progress Bar for an FTP download. The server where I am downloading the file has all of its directories and files hidden. I want to display the progress of the download. Is there any way I can get the file size? Here is my current code:
FTP client = new FTP Client();
FTP client.setListHiddenFiles
FTP client.connect(host Part);
FTP client.login(user Name, password);
FTPclient.setFileType(FTP.BINARY_FILE_TYPE);
Input Stream instream = FTP client.retrieveFileStream(pathExcludingHostIncludingFirstSlash);
int l;
byte[] tmp = new byte[2048];
int update Counter = 0;
int bytes Downloaded = 0;
while ((l = instream.read(tmp)) != -1) {
Foss.write(tmp, 0, l);
bytes Downloaded+=2048;
update Counter++;
if(update Counter==3){
kilobytes Downloaded=(bytes Downloaded / 1024);
publish Progress((String[])null);
update Counter=0}

View 1 Replies View Related

Android :: System Log Buffer Size

Feb 11, 2009

I have the following problem: I'd like to see the system log of two days ago and I cannot. I see only 3 last hours. How can I configure the system log size, location, severity?

View 6 Replies View Related

Android :: Any Way To Change LogCat Buffer Size?

Jan 30, 2010

Is there a way to change how big the logcat buffer is? or how much is buffered back? Especially when using DDMS.

View 3 Replies View Related

Android :: Buffer Size For Audio Track

Jun 17, 2009

This may be impossible but is there any way that I can get a smaller buffer size for AudioTrack than what is provided by getMinBufferSize method?

This is how I am instantiating AudioTrack right now: SR = 44100; bufSize = AudioTrack.getMinBufferSize(SR, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT); audioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, SR, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufSize, AudioTrack.MODE_STREAM);

With sample rate of 44100, getMinBufferSize always returns 4800. If I try to make the buffer size smaller than 4800 then I get the following error message: E/AudioTrack( 318): Invalid buffer size: minFrameCount 1200, frameCount 600 E/AudioTrack-JNI( 318): Error initializing AudioTrack E/AudioTrack-Java( 318): [ android.media.AudioTrack ] Error code -20 when initializing AudioTrack. D/AndroidRuntime( 318): Shutting down VM W/dalvikvm( 318): threadid=3: thread exiting with uncaught exception (group=0x4000fe70) E/AndroidRuntime( 318): Uncaught handler: thread main exiting due to uncaught exception I/CheckinService( 59): From server: Intent { action=android.server.checkin.FOTA_CANCEL } E/AndroidRuntime( 318): java.lang.RuntimeException: Unable to start activity Does anyone has any ideas how to over come this problem?

View 2 Replies View Related

Android :: Invalid Audio Buffer Size On Samsung Galaxy

Nov 14, 2009

The following works fine on a G1 but gives an error on the Samsung Galaxy. I was hoping cross-platform support would be better than this. See error below.

private final static int RATE = 44100; private final static int CHANNEL_MODE = AudioFormat.CHANNEL_CONFIGURATION_MONO; private final static int ENCODING = AudioFormat.ENCODING_PCM_16BIT; private AudioRecord recorder_; public boolean open() { int bufferSize = 4 * AudioRecord.getMinBufferSize(RATE, CHANNEL_MODE, ENCODING); recorder_ = new AudioRecord(AudioSource.MIC, RATE, CHANNEL_MODE, ENCODING, bufferSize);

last line gives the following on the Samsung Galaxy phone: 11-14 19:04:07.507: ERROR/AndroidRuntime(7617): java.lang.IllegalArgumentException: Invalid audio buffer size.

View 5 Replies View Related

Android :: Dalvik Message - Default Buffer Size Used In BufferedInputStream Constructor

Aug 17, 2010

When I used BufferedInputStream and I specify a buffer size, Dalvik gives me this warning - Default buffer size used in BufferedInputStream constructor. It would be better to be explicit if an 8k buffer is required.
But right now, my buffer size is already at 8k. What am I doing wrong?

View 1 Replies View Related

Android :: How To Get Input Stream Of An Xml File Which Is Placed Under /res / Xml?

May 16, 2010

I know when the xml file is under /res/raw,I can do this by context.getResources().openRawResource(rid); but when the xml file is under /res/xml,how can I do it? You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

View 4 Replies View Related

General :: Which Video Players Allow To Set Network Buffer Cache By Size And Time

Dec 26, 2012

The closest I know of are mxplayer and vplayer. Any xda alternatives people know of?

View 2 Replies View Related

Android :: How To Load A Typeface From An Input Stream?

Mar 15, 2010

The class Typeface has a couple of static factory methods which take different inputs. However, Input streams are not among themn (there is a way to load a file though). Is there a way around this apart from copying the font to a temporary file?

View 4 Replies View Related

Android :: Resetting A HTTP Input Stream?

Jan 9, 2010

I am getting the input of a web page using Input Stream in = httpConnection.getInputStream(); I then use the XmlPullParser to check if an error has occurred. If no error has occurred, I then want to reset the Input Stream back to the beginning so that I can parse it through another function I have created. I tried in.reset(); but this does not work. Is this possible?

View 4 Replies View Related

Android :: IO Exception While Reading From Input Stream?

Aug 13, 2009

I'm running into a strange problem while reading from an Input Stream on the Android platform. I'm not sure if this is an Android specific issue, or something I'm doing wrong in general. The only thing that is Android specific is this call:
Input Stream is = getResources().openRawResource(R.raw.myfile);
This returns an Input Stream for a file from the Android assets. Anyways, here's where I run into the issue:
bytes[] buffer = new bytes[2];
is.read(buffer);
When the read() executes it throws an IOException. The weird thing is that if I do two sequential single byte reads (or any number of single byte reads), there is no exception. Ie, this works:
byte buffer;
buffer = (byte)buffer.read();
buffer = (byte)buffer.read();
Any idea why two sequential single byte reads work but one call to read both at once throws an exception? The Input Stream seems fine... is.available() returns over a million bytes (as it should).
Stack trace shows these lines just before the Input Stream.read():
java.io.IOException
at android.content.res.AssetManager.readAsset(Native Method)
at android.content.res.AssetManager.access$800(AssetManager.java:36)
at android.content.res.AssetManager$AssetInputStream.read(AssetManager.java:542)
Changing the buffer size to a single byte still throws the error. It looks like the exception is only raised when reading into a byte array.
If I truncate the file to 100,000 bytes (file is: 1,917,408 bytes originally) it works fine. Is there a problem with files over a certain size?

View 3 Replies View Related

Android :: Chunked Encoding - GZIP Input Stream

Mar 3, 2010

I found a problem with GZIP input stream when wrapping InputStream from HttpURLConnection. When the server response with Transfer- Encoding=chunked, Content-Encoding=gzip and Connection=Keep-Alive. The second post always return -1. After digging into the source code, I found the place that could be a bug: InflaterInputStream.java (line 190 to 192) if (inf.needsInput()) { fill(); } Because InflaterInputStream doesn't need more input, it doesn't try to read the end of chunked encoding (0x)(30 0a 0d) that cause the second post to return with -1 every time.

View 3 Replies View Related

Android :: How Do I Replace HTML Escapes In An Input Stream Before Parsing It To XML?

Sep 17, 2010

I have an input stream which is being converted to XML, and read. When I get down to some text elements in the XML, they are truncated. I believe the parser is dropping everything after escaped HTML such as & Here is the code getting the input stream and then getting the text element. Code...

View 2 Replies View Related

Android :: Parsing Speed / Reading Vs Converting Input Stream To String?

Jul 23, 2009

I'm downloading text data from a web server, and getting an Input Stream. The data will be relatively large and delimited. I want to split this data by the deliminator and store each piece in the DB. Is it faster to read the Input Stream byte by byte to split the data and store each piece in the DB, or would it be faster to convert the Input Stream to a String and use an existing function such as Split?

View 2 Replies View Related

Android :: Read Local Xml File Is Resource Folder As A Input Stream In Android?

Aug 12, 2010

I am trying to get a input stream from something like this.

CODE:.........

And then call parse on the parser instance i Created. SOm how i get nothing . Works fine if I use a server XML....

View 1 Replies View Related

Android :: Why Is My Input Stream Not Working In Android?

Aug 23, 2010

I'm writing an image file up loader for android for my favorite image gallery software and it uses FTP.
I've started using Apache-Commons Net FTP as my ftp library based on past stack overflow questions. Like so:
FTP Client ftp = new FTP Client();
try{
ftp.connect(host);
Log.i(TAG,"we connected");
if(!ftp.login(user,pass)){
ftp.logout();
//TODO: alert user it didn't happen
return;
}
String reply Status = ftp.get Status();
Log.i(TAG,reply Status);
int reply Code = ftp.triplicate();
if (!FTPReply.isPositiveCompletion(reply Code))
{
ftp.disconnect();
//TODO: alert user it didn't happen
return;}
Log.i(TAG,"we logged in");
ftp.changeWorkingDirectory(path);
ftp.setFileType(ftp.BINARY_FILE_TYPE);
for(int i = 0; i < content Uris.size(); i++){
Log.i(TAG,"uploading new file");
Uri stream = (Uri) content Uris.get(i);
//InputStream in = openFileInput(getRealPathFromURI(stream));
Input Stream in =this.getContentResolver().openInputStream(stream);
BufferedInputStream buffing=null;
buffing=new BufferedInputStream(in);
ftp.setFileType(ftp.BINARY_FILE_TYPE);
boolean Store = ftp.storeFile("test.jpg", buffing);
Log.i(TAG, "uploaded test");

View 1 Replies View Related

Android :: OpenGL ES Flickering - Double Buffered

Oct 3, 2009

I'm trying to clean up some rendering issues for a 3D game -- CowPotato (http://www.cyrket.com/package/ com.froogloid.android.cowpotato).

Basically I'm seeing some flickering, like the next frame is getting flushed before everything is drawn. It is definitely the last few items in my display list that seem to flicker -- if I reorder the list, it's always the last part of the list that flickers.

I understand that the GLSurfaceView automatically provides double- buffering -- it certainly appears to be the case looking at the source. So any suggestions as to why I might be seeing flicker? I put counters into the drawing methods to make sure that all the objects are called each frame, they just don't show up on screen all the time.

View 18 Replies View Related

Android :: Getting Amount Of Audio Data Buffered In Device

Apr 5, 2010

I am trying to write a streaming application.I have my own decoder and I am playing PCM audio using AudioTrack. At any point in time I want to know how much data is buffered with the device. I want to use this so that if the data with the device go below a level, I want to go into a buffering mode where I will buffer 2-3 seconds of data before continuing playback again. Can someone please tell me how to do this?

View 5 Replies View Related

Android :: Input Field With Custom Input Method

Jan 6, 2010

I would like to show a custom input field (specifically, one containing only 9-0 and two extra buttons containing decimal separator (, or .) and a delete button). I could create a custom IME, but (as far as I know) that would have to be set by the user as the system-wide input method. Is there a way to implement an input method and bind it to a specific input field?

View 1 Replies View Related

Android :: Broken Pipe Exception When Tried To Stream Mp3 Stream From Local Server To Android Mediaplayer

Oct 27, 2010

I am trying to stream mp3 stream from my local http server indeed hosted on my phone to android media player.When local server gets the new socket , it starts writing some http headers followed by mp3 stream. but mediaplayer socket is throwing "Broken pipe" exception.Wat may be the issue causing this.

View 1 Replies View Related

Android :: Data Buffer Pass By Jni

Aug 4, 2009

Have some tryed to pas databuffer on android by jni?

View 6 Replies View Related

Android :: Alpha Buffer Support On G1

Mar 21, 2009

Is it possible to generate an EGL Config with an alpha buffer on the G1? When I request a non-zero number of bits for the alpha buffer I can get a R5G5B5A1 or R8G8B8A8 visual, but neither of them renders correctly to the screen. I assume that's because the G1 only supports R5G6B5 visuals. It does surprise me that I can even get those visuals though. It's fairly obvious looking at the 32bpp visual artifacts that the frame buffer is indeed laid out with 32bpp, but display hardware is treating it as 16bpp, resulting in the left and right halves of my scene rendering in alternate scan lines, with distorted colors. So does anyone know if there is any way to get an alpha buffer on the G1? I've tried using FBO's but they don't seem to be implemented either. Or I'm using them incorrectly. If I call glGenFrameBuffersOES on a GL11ExtensionPack reference I get an UnsupportedOperationException. I am getting my GL11ExtensionPack reference by casting the return value from my EGLContext.getGL() call.

View 2 Replies View Related

Android :: Alpha Buffer Support

May 24, 2009

Since Google groups doesn't let you add posts to threads more than 60 days old, and I want to leave a solution to the problem I encountered a while back, I'm posting this message with the same title in hopes that anyone running into the problem I had will find this message as well. I was having trouble getting my G1 to render an RGBA_8888 OpenGL context to the screen. Everything was twice the size it should be because the 8888 pixels were being interpreted as two 565 pixels. The colors were obviously wrong as well. I had missed a critical function call. You must configure the Surface that is being used by EGL using the SurfaceHolder method setFormat. The pixel format needs to be TRANSLUCENT, or more specifically you can use RGBA_8888.

View 2 Replies View Related

Android :: How To Empty The Logcat Buffer

Jul 23, 2010

How can I empty the logcat buffer in Android? I use adb logcat from command line and pipe the output to a file, since the DDMS has a very limited buffer. At the moment, when I restart my app (after fixing bugs etc) the logcat buffer has data from the previous launch as well. Even uninstalling the app does not clear the buffer. The only way I've found so far to clear the buffer, is reboot. This is effective, but would like to know if there's an easier way.

View 1 Replies View Related

Android : Why Does Internet Radio Always Buffer

Oct 5, 2010

I like to listen to internet radio stations due to the variety of music i can listen to and also due to the lack of full Flash support yet for 2.1

my 3G & HSDPA signal is excellent almost anywhere....at home, at work and on the road and out and about. i'm with T-mobile (UK) for the past 5 years and i'm very happy with their service. and the signal.

but sometimes the internet radio still buffers sometimes even with an almost excellent signal. why is this? any explanation?

View 6 Replies View Related

Android :: How Do I Make My Image View Fixed Size Regardless Of Size Of Bitmap

Sep 23, 2010

So I'm loading images from a web service, but the size of the images are sometimes smaller or bigger than other images and the visualization looks silly when I put them in a ListView in android. I'd like to fix the size of my ImageView so that it only shows a portion of the image if it's larger than a preset amount. I've tried everything I can think of setting the setMaxWidth/setMaxHeight, setting the scale type to centerCrop, using ClipableDrawable wrapping my BitmapDrawable, setting using Drawable.setBounds(). I've tried setting in the XML and programmatically, but neither worked. I'm very surprised setting max width/height didn't do anything. Below is the XML I'm using ImageView definition in my layout file

View 1 Replies View Related

Android :: How To Capture Audio Data From Mic Into A Buffer?

Sep 24, 2009

I am working on a packet switched network. I want to capture the audio data from mic into a buffer at a desired sample rate.How can I capture the audio data from mic into a buffer instead of a file? Also how can I control the audio capture rate as per the desired sample rate?

View 2 Replies View Related

Android :: Better (Video Buffer) YouTube Application?

Oct 19, 2010

I've pretty much fed up with the stock Youtube app on my Moto Droid, and was wondering if there are any alternate apps or fixes out there. Between it flipping a nut if I try to seek further into the video and the fact that it won't allow me to buffer the video at all is what tweaks me the most. Whats the point of trying to watch anything over 3G if I'm only gunna get 3 seconds of video followed by 3 seconds of buffering through the whole thing?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved