public void dumpData() { TFTPUtils.puts("--------------DATA DUMP---------------------"); TFTPUtils.puts("Packet Size: " + current_packet_size); TFTPUtils.puts(new String(data)); TFTPUtils.puts("--------------------------------------------"); }
public boolean sendPacket(BufferedOutputStream out) { try { out.write(data, 0, getSize()); out.flush(); return true; } catch (Exception e) { TFTPUtils.puts("Exception in sendPacket()"); return false; } }
public boolean addMemory(byte[] buf, int buf_size) { if (current_packet_size + buf_size >= TFTP_PACKET_MAX_SIZE) { TFTPUtils.puts("Packet size exceeded"); return false; } for (int i = 0; i < buf_size; i++) { data[current_packet_size + i] = buf[i]; } current_packet_size += buf_size; return false; }
public boolean getPacket(BufferedInputStream in) { clear(); int bytes_read = 0; try { bytes_read = in.read(data, 0, TFTP_PACKET_MAX_SIZE); if (bytes_read == -1) { return false; } setSize(bytes_read); } catch (Exception e) { TFTPUtils.puts("Exception in getPacket()"); return false; } return true; }