// Path: Android/Blink/library/src/main/java/net/qiujuer/blink/core/BlinkPacket.java
// public abstract class BlinkPacket implements Packet {
//     private boolean mSucceed;
//     protected byte mType;
//     protected long mLength;
// 
//     public BlinkPacket(byte type) {
//         mType = type;
//     }
// 
// 
//     @Override
//     public byte getPacketType() {
//         return mType;
//     }
// 
//     @Override
//     public long getLength() {
//         return mLength;
//     }
// 
//     @Override
//     public void setSuccess(boolean isSuccess) {
//         mSucceed = isSuccess;
//     }
// 
//     @Override
//     public boolean isSucceed() {
//         return mSucceed;
//     }
// 
//     /**
//      * On Send or Receive start call this
//      *
//      * @return Init status
//      */
//     public abstract boolean startPacket();
// 
//     /**
//      * On Send or Receive end call this
//      */
//     public abstract void endPacket();
// 
//     /**
//      * Blink Packet Type
//      */
//     public static class PacketType {
//         public final static byte STRING = 1;
//         public final static byte BYTES = 2;
//         public final static byte FILE = 3;
//     }
// }
// 
// Path: Java/Blink/library/src/net/qiujuer/blink/core/ReceivePacket.java
// public abstract class ReceivePacket extends Packet {
//     private final long mId;
//     private String mHash;
// 
//     public ReceivePacket(long id, byte type, long len) {
//         super(type);
//         mId = id;
//         mLength = len;
//     }
// 
//     public long getId() {
//         return mId;
//     }
// 
//     /**
//      * Set Packet Hash Code
//      *
//      * @param hashCode HashCode
//      */
//     public void setHash(String hashCode) {
//         mHash = hashCode;
//     }
// 
//     /**
//      * Get Packet Hash Code
//      *
//      * @return HashCode
//      */
//     public String getHash() {
//         return mHash;
//     }
// 
//     /**
//      * On Receiver receive same info buffer call this
//      *
//      * @param bytes Info data
//      */
//     public void setInfo(byte[] bytes) {
//     }
// 
//     /**
//      * Receiver write buffer
//      *
//      * @param buffer Buffer
//      * @param offset Buffer offset
//      * @param count  Buffer Count
//      */
//     public abstract void write(byte[] buffer, int offset, int count);
// }
// 
// Path: Android/Blink/old/src/main/java/net/qiujuer/blink/core/Resource.java
// public interface Resource<T> {
//     /**
//      * Create a file from resource.
//      *
//      * @return New file
//      */
//     File create(long id);
// 
//     /**
//      * Change a file name
//      *
//      * @param file    File
//      * @param newName New name
//      * @return Status
//      */
//     boolean rename(File file, String newName);
// 
// 
//     /**
//      * Cut a file to new path
//      *
//      * @param oldFile File
//      * @param newPath New path
//      * @return New File
//      */
//     File cut(File oldFile, String newPath);
// 
//     /**
//      * Cut a file to new path
//      *
//      * @param oldFile Old file
//      * @param newFile New file
//      * @return New file
//      */
//     File cut(File oldFile, File newFile);
// 
// 
//     /**
//      * Removes a file from the resource.
//      *
//      * @param name File name
//      */
//     void remove(String name);
// 
//     /**
//      * Removes a file from the resource.
//      *
//      * @param file File
//      */
//     void remove(File file);
// 
//     /**
//      * Empties the resource by oneself
//      */
//     void clear();
// 
//     /**
//      * Empties the resource by the path
//      */
//     void clearAll();
// 
//     /**
//      * Get the Mark
//      *
//      * @return T
//      */
//     T getMark();
// }


import net.qiujuer.blink.box.ByteReceivePacket;
import net.qiujuer.blink.box.FileReceivePacket;
import net.qiujuer.blink.box.StringReceivePacket;
import net.qiujuer.blink.core.BlinkPacket;
import net.qiujuer.blink.core.BlinkParser;
import net.qiujuer.blink.core.ReceivePacket;
import net.qiujuer.blink.core.Resource;
import java.io.File;
/*
 * Copyright (C) 2014 Qiujuer <qiujuer@live.cn>
 * WebSite http://www.qiujuer.net
 * Created 04/16/2015
 * Changed 04/19/2015
 * Version 1.0.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.qiujuer.blink.kit;




public class BlinkParserImpl implements BlinkParser {
    private long mId = 0;
    protected Resource mResource;

    public BlinkParserImpl(Resource resource) {
        mResource = resource;
    }

    @Override
// Path: Android/Blink/library/src/main/java/net/qiujuer/blink/core/BlinkPacket.java
// public abstract class BlinkPacket implements Packet {
//     private boolean mSucceed;
//     protected byte mType;
//     protected long mLength;
// 
//     public BlinkPacket(byte type) {
//         mType = type;
//     }
// 
// 
//     @Override
//     public byte getPacketType() {
//         return mType;
//     }
// 
//     @Override
//     public long getLength() {
//         return mLength;
//     }
// 
//     @Override
//     public void setSuccess(boolean isSuccess) {
//         mSucceed = isSuccess;
//     }
// 
//     @Override
//     public boolean isSucceed() {
//         return mSucceed;
//     }
// 
//     /**
//      * On Send or Receive start call this
//      *
//      * @return Init status
//      */
//     public abstract boolean startPacket();
// 
//     /**
//      * On Send or Receive end call this
//      */
//     public abstract void endPacket();
// 
//     /**
//      * Blink Packet Type
//      */
//     public static class PacketType {
//         public final static byte STRING = 1;
//         public final static byte BYTES = 2;
//         public final static byte FILE = 3;
//     }
// }
// 
// Path: Java/Blink/library/src/net/qiujuer/blink/core/ReceivePacket.java
// public abstract class ReceivePacket extends Packet {
//     private final long mId;
//     private String mHash;
// 
//     public ReceivePacket(long id, byte type, long len) {
//         super(type);
//         mId = id;
//         mLength = len;
//     }
// 
//     public long getId() {
//         return mId;
//     }
// 
//     /**
//      * Set Packet Hash Code
//      *
//      * @param hashCode HashCode
//      */
//     public void setHash(String hashCode) {
//         mHash = hashCode;
//     }
// 
//     /**
//      * Get Packet Hash Code
//      *
//      * @return HashCode
//      */
//     public String getHash() {
//         return mHash;
//     }
// 
//     /**
//      * On Receiver receive same info buffer call this
//      *
//      * @param bytes Info data
//      */
//     public void setInfo(byte[] bytes) {
//     }
// 
//     /**
//      * Receiver write buffer
//      *
//      * @param buffer Buffer
//      * @param offset Buffer offset
//      * @param count  Buffer Count
//      */
//     public abstract void write(byte[] buffer, int offset, int count);
// }
// 
// Path: Android/Blink/old/src/main/java/net/qiujuer/blink/core/Resource.java
// public interface Resource<T> {
//     /**
//      * Create a file from resource.
//      *
//      * @return New file
//      */
//     File create(long id);
// 
//     /**
//      * Change a file name
//      *
//      * @param file    File
//      * @param newName New name
//      * @return Status
//      */
//     boolean rename(File file, String newName);
// 
// 
//     /**
//      * Cut a file to new path
//      *
//      * @param oldFile File
//      * @param newPath New path
//      * @return New File
//      */
//     File cut(File oldFile, String newPath);
// 
//     /**
//      * Cut a file to new path
//      *
//      * @param oldFile Old file
//      * @param newFile New file
//      * @return New file
//      */
//     File cut(File oldFile, File newFile);
// 
// 
//     /**
//      * Removes a file from the resource.
//      *
//      * @param name File name
//      */
//     void remove(String name);
// 
//     /**
//      * Removes a file from the resource.
//      *
//      * @param file File
//      */
//     void remove(File file);
// 
//     /**
//      * Empties the resource by oneself
//      */
//     void clear();
// 
//     /**
//      * Empties the resource by the path
//      */
//     void clearAll();
// 
//     /**
//      * Get the Mark
//      *
//      * @return T
//      */
//     T getMark();
// }


// Path: Android/Blink/library/src/main/java/net/qiujuer/blink/kit/BlinkParserImpl.java
import net.qiujuer.blink.box.ByteReceivePacket;
import net.qiujuer.blink.box.FileReceivePacket;
import net.qiujuer.blink.box.StringReceivePacket;
import net.qiujuer.blink.core.BlinkPacket;
import net.qiujuer.blink.core.BlinkParser;
import net.qiujuer.blink.core.ReceivePacket;
import net.qiujuer.blink.core.Resource;
import java.io.File;

/*
 * Copyright (C) 2014 Qiujuer <qiujuer@live.cn>
 * WebSite http://www.qiujuer.net
 * Created 04/16/2015
 * Changed 04/19/2015
 * Version 1.0.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.qiujuer.blink.kit;




public class BlinkParserImpl implements BlinkParser {
    private long mId = 0;
    protected Resource mResource;

    public BlinkParserImpl(Resource resource) {
        mResource = resource;
    }

    @Override
    public ReceivePacket parseReceive(byte type, long len) {