Java Reference
In-Depth Information
public String getForecast() {
if (forecast != null) {
return forecast;
} else {
return "";
}
}
public void setForecast(String f) {
forecast = f;
}
public int getId() {
return recordId;
}
public void setId(int id) {
recordId = id;
}
public byte[] toBytes() {
byte[] b;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
// Record format is field-tag, then field for each
try {
dos.writeInt(FIELD_VERSION);
dos.writeInt(version);
if (location != null) {
dos.writeInt(FIELD_LOCATION);
dos.writeUTF(getLocation());
}
if (forecast != null)
{
dos.writeInt(FIELD_FORECAST);
dos.writeUTF(getForecast());
}
}
catch( Exception e) {
return null;
}
 
Search WWH ::




Custom Search