View Javadoc
1   package com.srv4pos.server.api.sync.sample;
2   
3   import com.srv4pos.server.api.sale.SaleSlotInfo;
4   
5   import java.io.ByteArrayInputStream;
6   import java.io.InputStream;
7   
8   /**
9    * Created by misha on 30.06.16.
10   */
11  public class SyncSaleSlot extends SyncEntity<SaleSlotInfo> {
12      private byte[] icon;
13  
14      public SyncSaleSlot(SaleSlotInfo info, boolean synced) {
15          super(info, synced);
16      }
17  
18      public SyncSaleSlot(SaleSlotInfo info) {
19          super(info);
20      }
21  
22  
23      public InputStream getPictureInputStream() {
24          return icon == null ? null : new ByteArrayInputStream(icon);
25      }
26  
27      public void setPictureBytes(byte[] buf) {
28          icon = new byte[buf.length];
29          System.arraycopy(buf, 0, icon, 0, buf.length);
30      }
31  
32      /**
33       * <p>This method is <b>for testing purposes only</b> (it is used in unit tests and in integration tests).
34       * Actual sync helpers (and thus sync algorithm) does not use it.</p>
35       * @return category picture as array of bytes
36       */
37      public byte[] getPictureBytes() {
38          return icon == null ? null : icon.clone();
39      }
40  }