Mercurial > 510Connectbot
comparison app/src/main/java/org/tn5250j/framework/tn5250/DataStreamProducer.java @ 446:5ce5235adde6
fix compile errors
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 04 Jan 2016 16:38:16 -0800 |
parents | 8fa8e73e2f5c |
children |
comparison
equal
deleted
inserted
replaced
445:8fa8e73e2f5c | 446:5ce5235adde6 |
---|---|
1 package org.tn5250j.framework.tn5250; | 1 package org.tn5250j.framework.tn5250; |
2 | |
3 import org.tn5250j.encoding.ICodePage; | |
2 | 4 |
3 import java.io.BufferedInputStream; | 5 import java.io.BufferedInputStream; |
4 import java.io.ByteArrayOutputStream; | 6 import java.io.ByteArrayOutputStream; |
5 import java.io.IOException; | 7 import java.io.IOException; |
6 import java.net.SocketException; | 8 import java.net.SocketException; |
86 int bufferLen = streamBuffer.length; | 88 int bufferLen = streamBuffer.length; |
87 | 89 |
88 Log.d(TAG, "loadStream() offset=" + offset + " partialLen=" + partialLen + " bufferLen=" + bufferLen); | 90 Log.d(TAG, "loadStream() offset=" + offset + " partialLen=" + partialLen + " bufferLen=" + bufferLen); |
89 | 91 |
90 if (saveStream != null) { | 92 if (saveStream != null) { |
91 log.debug("partial stream found"); | 93 Log.d(TAG, "partial stream found"); |
92 bufferLen = saveStream.length + streamBuffer.length; | 94 bufferLen = saveStream.length + streamBuffer.length; |
93 byte[] inter = new byte[bufferLen]; | 95 byte[] inter = new byte[bufferLen]; |
94 System.arraycopy(saveStream, 0, inter, 0, saveStream.length); | 96 System.arraycopy(saveStream, 0, inter, 0, saveStream.length); |
95 System.arraycopy(streamBuffer, 0, inter, saveStream.length, streamBuffer.length); | 97 System.arraycopy(streamBuffer, 0, inter, saveStream.length, streamBuffer.length); |
96 streamBuffer = new byte[bufferLen]; | 98 streamBuffer = new byte[bufferLen]; |
104 System.arraycopy(streamBuffer, 0, saveStream, 0, streamBuffer.length); | 106 System.arraycopy(streamBuffer, 0, saveStream, 0, streamBuffer.length); |
105 } else { | 107 } else { |
106 int buf_len = partialLen + 2; | 108 int buf_len = partialLen + 2; |
107 byte[] buf = new byte[buf_len]; | 109 byte[] buf = new byte[buf_len]; |
108 if (isBufferShifted(partialLen, bufferLen) && isOpcodeShifted(streamBuffer, offset)) { | 110 if (isBufferShifted(partialLen, bufferLen) && isOpcodeShifted(streamBuffer, offset)) { |
109 log.debug("Invalid stream buffer detected. Ignoring the inserted byte."); | 111 Log.d(TAG, "Invalid stream buffer detected. Ignoring the inserted byte."); |
110 System.arraycopy(streamBuffer, offset, buf, 0, MINIMAL_PARTIAL_STREAM_LEN); | 112 System.arraycopy(streamBuffer, offset, buf, 0, MINIMAL_PARTIAL_STREAM_LEN); |
111 System.arraycopy(streamBuffer, offset + MINIMAL_PARTIAL_STREAM_LEN + 1, buf, MINIMAL_PARTIAL_STREAM_LEN, partialLen); | 113 System.arraycopy(streamBuffer, offset + MINIMAL_PARTIAL_STREAM_LEN + 1, buf, MINIMAL_PARTIAL_STREAM_LEN, partialLen); |
112 } else { | 114 } else { |
113 System.arraycopy(streamBuffer, offset, buf, 0, buf_len); | 115 System.arraycopy(streamBuffer, offset, buf, 0, buf_len); |
114 } | 116 } |
259 | 261 |
260 protected void toggleDebug(ICodePage codePage) { | 262 protected void toggleDebug(ICodePage codePage) { |
261 dataStreamDumper.toggleDebug(codePage); | 263 dataStreamDumper.toggleDebug(codePage); |
262 } | 264 } |
263 | 265 |
266 } |