트위터 API 데이터로 작업하고 있으며 스트림 결과를 텍스트 파일에 저장 한 후 데이터를 파서 응용 프로그램에 입력했습니다. 내가 계획 한 것은 큰 데이터 파일 이었으므로 구분 기호를 사용하여 내용을 읽음]} 오류 가능성을 피하기 위해 개별 게시물을 분리 하시겠습니까? 백업 기능은 버퍼를 사용하여 데이터를 읽은 다음 개별 게시물로 스 니핑하는 것이 었습니다. 그러나 문제는 단일 게시물의 경우 메모리 예외가 발생한다는 것입니다. 이제 개별 게시물을 볼 때 필연적으로 커 보이지는 않지만 텍스트에는 외래 문자가 포함되거나 메모리 예외가 발생하는 일부 인코딩이 포함됩니다. 나는 메모리 예외가 발생파일에서 xml을 읽을 때 outofmemory 예외가 발생했습니다.
myreader.TextFieldType = FileIO.FieldType.Delimited
myreader.SetDelimiters("]}}")
Dim currentRow As String()
Try
While Not myreader.EndOfData
Try
currentRow = myreader.ReadFields()
Dim currentField As String
For Each currentField In currentRow
data = data + currentField
counter += 1
If counter = 1000 Then
Dim pt As New parsingUtilities
If Not data = "" Then
pt.getNodes(data)
counter = 0
End If
End If
Next
Catch ex As Exception
If ex.Message.Contains("MemoryException") Then
fileBKup()
End If
End Try
다른 시간 나는 다른 게시물로 분할하려고 다음은 ... 바로이 아직 있는지 생각하지만 난 여기에서 몇 가지 입력 또는 조언을 얻을 것이라고 생각하지 않은 :
Dim sampleResults() As String
Dim stringSplitter() As String = {"}}"}
' split the file content based on the closing entry tag
sampleResults = Nothing
Try
sampleResults = post.Split(stringSplitter, StringSplitOptions.RemoveEmptyEntries)
Catch ex As Exception
appLogs.constructLog(ex.Message.ToString, True, True)
moveErrorFiles(form1.infile)
Exit Sub
End Try