Back to project page ExampleApp.
The source code is released under:
Copyright (c) 2014, Altinn All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redis...
If you think the Android project ExampleApp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.altinn.apps.fisher.models; /**// w ww. j a v a 2 s . c o m * Currently not in Use. * A class for future use * */ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; public class CaughtInfoData extends InfoData { public CaughtInfoData(){ init(); } public CaughtInfoData(byte[] data){ init(data); } private void init(){ } public byte[] getBytes(){ ByteArrayOutputStream bos = null; DataOutputStream dos = null; try { bos = new ByteArrayOutputStream(); dos = new DataOutputStream(bos); dos.writeInt(mId); dos.writeInt(mFormType); dos.writeLong(mCreateId); dos.writeLong(mSendId); dos.flush(); bos.flush(); return bos.toByteArray(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally{ if(bos != null){ try { bos.close(); } catch (IOException e) { e.printStackTrace(); } } if(dos != null){ try { dos.close(); } catch (IOException e) { e.printStackTrace(); } } } return null; } private void init(byte[] data){ init(); ByteArrayInputStream bis = null; DataInputStream dis = null; try { bis = new ByteArrayInputStream(data); dis = new DataInputStream(bis); mId = dis.readInt(); mFormType = dis.readInt(); mCreateId = dis.readLong(); mSendId = dis.readLong(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally{ if(bis != null){ try { bis.close(); } catch (IOException e) { e.printStackTrace(); } } if(dis != null){ try { dis.close(); } catch (IOException e) { e.printStackTrace(); } } } } public void setTempVlaues(){ mCreateId = System.currentTimeMillis(); } }