Java Code Examples for android.os.Parcel#dataAvail()
The following examples show how to use
android.os.Parcel#dataAvail() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UndoBuffer.java From PowerFileExplorer with GNU General Public License v3.0 | 6 votes |
private UndoBuffer(Parcel in) { this(); int len = in.readInt(); while( in.dataAvail() > 0 && len-- > 0){ TextChange item = new TextChange(); item.start = in.readInt(); item.oldtext = in.readString(); item.newtext = in.readString(); if ( item.newtext == null ){ item.newtext = ""; } if ( item.oldtext == null ){ item.oldtext = ""; } mBuffer.add(item); mCurrentSize += item.newtext.length() + item.oldtext.length(); } }
Example 2
Source File: Presence.java From Zom-Android-XMPP with GNU General Public License v3.0 | 6 votes |
public Presence(Parcel source) { mStatus = source.readInt(); mStatusText = source.readString(); mAvatarData = source.createByteArray(); mAvatarType = source.readString(); mClientType = source.readInt(); // TODO - what ClassLoader should be passed to readMap? // TODO - switch to Bundle mExtendedInfo = source.readHashMap(null); //this may not exist for older persisted presence data if (source.dataAvail() > 0) mResource = source.readString(); if (source.dataAvail() > 0) { long timeLastSeen = source.readLong(); if (timeLastSeen != -1) mLastSeen = new Date(timeLastSeen); } }
Example 3
Source File: UndoBuffer.java From JotaTextEditor with Apache License 2.0 | 6 votes |
private UndoBuffer(Parcel in) { this(); int len = in.readInt(); while( in.dataAvail() > 0 && len-- > 0){ TextChange item = new TextChange(); item.start = in.readInt(); item.oldtext = in.readString(); item.newtext = in.readString(); if ( item.newtext == null ){ item.newtext = ""; } if ( item.oldtext == null ){ item.oldtext = ""; } mBuffer.add(item); mCurrentSize += item.newtext.length() + item.oldtext.length(); } }
Example 4
Source File: RevokeMsgInfoImpl.java From QNotified with GNU General Public License v3.0 | 5 votes |
public RevokeMsgInfoImpl(Parcelable o) { if (o == null) throw new NullPointerException("RevokeMsgInfo == null"); Parcel p = Parcel.obtain(); try { o.writeToParcel(p, 0); p.setDataPosition(0); istroop = p.readInt(); shmsgseq = p.readLong(); friendUin = p.readString(); sendUin = p.readString(); msgUid = p.readLong(); time = p.readLong(); if (p.dataAvail() > 0) authorUin = p.readString(); if (p.dataAvail() > 0) opType = p.readInt(); } catch (Exception e) { log(e); } p.recycle(); String summery = o.toString(); int keyIndex = summery.indexOf("fromuin"); if (keyIndex == -1) { log("RevokeMsgInfoImpl/E indexOf('fromuin') == -1, leave fromUin null"); return; } int valueStart = summery.indexOf('=', keyIndex) + 1; if (summery.charAt(valueStart) == ' ') valueStart++; int end1 = summery.indexOf(',', valueStart); int end2 = summery.indexOf(' ', valueStart); if (end1 == -1) end1 = summery.length() - 1; if (end2 == -1) end2 = summery.length() - 1; int end = Math.min(end1, end2); String str = summery.substring(valueStart, end); if (str.equals("null")) { fromUin = null; } else { fromUin = str; } }
Example 5
Source File: HoverView.java From hover with Apache License 2.0 | 5 votes |
VisualState(Parcel in) { super(in); if (in.dataAvail() > 0) { int side = in.readInt(); float dockVerticalPositionPercent = in.readFloat(); mSidePosition = new SideDock.SidePosition(side, dockVerticalPositionPercent); } if (in.dataAvail() > 0) { mSelectedSectionId = new HoverMenu.SectionId(in.readString()); } }
Example 6
Source File: SdlPacket.java From sdl_java_suite with BSD 3-Clause "New" or "Revised" License | 5 votes |
public SdlPacket(Parcel p) { this.version = p.readInt(); this.encryption = (p.readInt() == 0) ? false : true; this.frameType = p.readInt(); this.serviceType = p.readInt(); this.frameInfo = p.readInt(); this.sessionId = p.readInt(); this.dataSize = p.readInt(); this.messageId = p.readInt(); if(p.readInt() == 1){ //We should have a payload attached payload = new byte[dataSize]; p.readByteArray(payload); } this.priorityCoefficient = p.readInt(); if(p.dataAvail() > EXTRA_PARCEL_DATA_LENGTH) { //See note on constant for why not 0 try { messagingVersion = p.readInt(); if (messagingVersion >= 2) { if (p.readInt() == 1) { //We should have a transport type attached this.transportRecord = (TransportRecord) p.readParcelable(TransportRecord.class.getClassLoader()); } } }catch (RuntimeException e){ DebugTool.logError("Error creating packet from parcel", e); } } }
Example 7
Source File: SdlPacket.java From sdl_java_suite with BSD 3-Clause "New" or "Revised" License | 5 votes |
public SdlPacket(Parcel p) { this.version = p.readInt(); this.encryption = (p.readInt() == 0) ? false : true; this.frameType = p.readInt(); this.serviceType = p.readInt(); this.frameInfo = p.readInt(); this.sessionId = p.readInt(); this.dataSize = p.readInt(); this.messageId = p.readInt(); if(p.readInt() == 1){ //We should have a payload attached payload = new byte[dataSize]; p.readByteArray(payload); } this.priorityCoefficient = p.readInt(); if(p.dataAvail() > EXTRA_PARCEL_DATA_LENGTH) { //See note on constant for why not 0 try { messagingVersion = p.readInt(); if (messagingVersion >= 2) { if (p.readInt() == 1) { //We should have a transport type attached this.transportRecord = (TransportRecord) p.readParcelable(TransportRecord.class.getClassLoader()); } } }catch (RuntimeException e){ DebugTool.logError("Error creating packet from parcel", e); } } }