• 125 Vote(s) - 2.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Run in memory
' open a file stream for reading, and load into a memory stream
  Public Shared Function StreamToMemory(ByVal path As String) As IO.MemoryStream
    Dim input As IO.FileStream
    Dim output As IO.MemoryStream
    input = New IO.FileStream(path, IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read)
    output = StreamToMemory(input)
    Return output
  End Function
  ' transfer contents of input stream to memory stream
  Public Shared Function StreamToMemory(ByVal input As IO.Stream) As IO.MemoryStream
    Dim buffer(1023) As Byte
    Dim count As Integer = 1024
    Dim output As IO.MemoryStream
    ' build a new stream
    If input.CanSeek Then
      output = New IO.MemoryStream(input.Length)
      output = New IO.MemoryStream
    End If
    ' iterate stream and transfer to memory stream
      count = input.Read(buffer, 0, count)
      If count = 0 Then Exit Do
      output.Write(buffer, 0, count)
    ' rewind stream
    output.Position = 0
    ' pass back
    Return output
  End Function

Forum Jump:

Users browsing this thread: 1 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: './pxramin_parsii/mybb_threadviews.MYI' (errno: 2 "No such file or directory")
INSERT INTO mybb_threadviews (tid) VALUES('1292')