요르딩딩
Vo 만드는 법 본문
728x90
반응형
package com.vo;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
public class SComVO {
//공통부
private byte [] len = new byte[4];
private byte [] sys = new byte[3];
// DB 정보
private String st;
private String bank;
private long id = 0;
private int dbcount = 0;
protected final Charset cs = Charset.forName("ksc5601");
public SComVO() {}
public byte[] getTelegramTest() {
byte[] telegram = new byte[200];
ByteBuffer bf = ByteBuffer.wrap(telegram);
bf.put(this.len);
bf.put(this.sys);
return telegram;
}
public ByteBuffer setTelegramTest(byte[] inComData) {
ByteBuffer bf = ByteBuffer.wrap(inComData);
bf.get(this.len);
bf.get(this.sys);
return bf;
}
public String fillStrTest(String inString, int len) {
if(inString == null) inString ="";
if (inString.length() >= len) {
return inString;
}
StringBuilder sb = new StringBuilder();
sb.append(inString);
while (sb.length() < len - inString.length()) {
sb.append(' ');
}
return sb.toString();
}
public String fillNumTest(String inString, int len) {
if(inString == null) inString ="";
if (inString.length() >= len) {
return inString;
}
StringBuilder sb = new StringBuilder();
while (sb.length() < len - inString.length()) {
sb.append('0');
}
sb.append(inString);
return sb.toString();
}
public String getLen() {
return new String(len,cs);
}
public void setLen(String len) {
if(len == null) return;
this.len = len.getBytes(cs);
}
public String getSys() {
return new String(sys,cs);
}
public void setSys(String sys) {
if(sys == null) return;
this.sys= sys.getBytes(cs);
}
public String getSts() {
return sts;
}
public void setSts(String sts) {
if(sts == null) return;
this.sts = sts;
}
public String getBank() {
return bank;
}
public void setBank(String bank) {
if(bank == null) return;
this.bank = bank;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public int getDbcount() {
return dbcount;
}
public void setDbcount(int dbcount) {
this.dbcount = dbcount;
}
}
728x90
반응형
'[Web] > [Spring]' 카테고리의 다른 글
@RequestBody로 body데이터 꺼내기 (0) | 2022.04.21 |
---|---|
[뉴렉처] Spring MVC 강의 (1,2,3,4,5) (0) | 2022.03.14 |
계층구조 쿼리 & makeTree (0) | 2021.11.23 |
[Spring 분석] 메일 템플릿을 활용한 메일작성 (0) | 2021.10.01 |
context-common.xml 에 대해 알아보자 (0) | 2021.09.15 |
Comments